diff options
author | Jonatan Kronqvist <jonatan@vaadin.com> | 2014-03-28 12:55:33 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-03-31 13:37:27 +0000 |
commit | 353a1a1c3073975ddc6d0f25d8d2b21b9df94343 (patch) | |
tree | 73c62e2c993c3c035fe2ba242c5f9583ebe2f54d /theme-compiler/tests/src/com | |
parent | 74bfd5e20759f0c26b40b41754129cbd71e0eff3 (diff) | |
download | vaadin-framework-353a1a1c3073975ddc6d0f25d8d2b21b9df94343.tar.gz vaadin-framework-353a1a1c3073975ddc6d0f25d8d2b21b9df94343.zip |
Remove theme-compiler and replace with external vaadin-sass-compiler
* Moves CompileTheme from the theme-compiler to buildhelpers
* Refactors CompileTheme to get the Vaadin version on the command line
instead of using the Version class found in vaadin-shared
* Refactors build scripts to pass the version number on the command line
when running CompileTheme
* Removes the theme-compiler module/project/whatchamacallit
* Replaces the theme-compiler dependency with vaadin-sass-compiler 0.9.0
from maven
Change-Id: I4f98d15b60e18a826bf264eb55d12b3e736e8e54
Diffstat (limited to 'theme-compiler/tests/src/com')
32 files changed, 0 insertions, 2417 deletions
diff --git a/theme-compiler/tests/src/com/vaadin/sass/AbstractTestBase.java b/theme-compiler/tests/src/com/vaadin/sass/AbstractTestBase.java deleted file mode 100644 index ff92b636ed..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/AbstractTestBase.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass; - -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.net.URISyntaxException; - -import junit.framework.Assert; - -import org.apache.commons.io.IOUtils; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.internal.ScssStylesheet; - -public abstract class AbstractTestBase { - - public static final String CR = "\r"; - - protected ScssStylesheet stylesheet; - protected String originalScss; - protected String parsedScss; - protected String comparisonCss; - - public ScssStylesheet getStyleSheet(String filename) - throws URISyntaxException, CSSException, IOException { - File file = getFile(filename); - stylesheet = ScssStylesheet.get(file.getAbsolutePath()); - return stylesheet; - } - - public File getFile(String filename) throws URISyntaxException, - CSSException, IOException { - return new File(getClass().getResource(filename).toURI()); - } - - public String getFileContent(String filename) throws IOException, - CSSException, URISyntaxException { - File file = getFile(filename); - return getFileContent(file); - } - - /** - * Read in the full content of a file into a string. - * - * @param file - * the file to be read - * @return a String with the content of the - * @throws IOException - * when file reading fails - */ - public String getFileContent(File file) throws IOException { - return IOUtils.toString(new FileReader(file)); - } - - public void testParser(String file) throws CSSException, IOException, - URISyntaxException { - originalScss = getFileContent(file); - originalScss = originalScss.replaceAll(CR, ""); - ScssStylesheet sheet = getStyleSheet(file); - parsedScss = sheet.printState(); - parsedScss = parsedScss.replace(CR, ""); - Assert.assertEquals("Original CSS and parsed CSS do not match", - originalScss, parsedScss); - } - - public void testCompiler(String scss, String css) throws Exception { - comparisonCss = getFileContent(css); - comparisonCss = comparisonCss.replaceAll(CR, ""); - ScssStylesheet sheet = getStyleSheet(scss); - sheet.compile(); - parsedScss = sheet.printState(); - parsedScss = parsedScss.replaceAll(CR, ""); - Assert.assertEquals("Original CSS and parsed CSS do not match", - comparisonCss, parsedScss); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluatorTest.java b/theme-compiler/tests/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluatorTest.java deleted file mode 100644 index c408255d0e..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/internal/expression/ArithmeticExpressionEvaluatorTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.sass.internal.expression; - -import org.junit.Assert; -import org.junit.Test; -import org.w3c.css.sac.LexicalUnit; - -import com.vaadin.sass.internal.expression.exception.ArithmeticException; -import com.vaadin.sass.internal.expression.exception.IncompatibleUnitsException; -import com.vaadin.sass.internal.parser.LexicalUnitImpl; - -public class ArithmeticExpressionEvaluatorTest { - private ArithmeticExpressionEvaluator evaluator = new ArithmeticExpressionEvaluator(); - - @Test - public void testPrecedenceSameAsAppearOrder() { - // 2 * 3 - 4 = 2 - LexicalUnitImpl operand2 = LexicalUnitImpl.createInteger(0, 0, null, 2); - LexicalUnitImpl operatorMultiply = LexicalUnitImpl.createMultiply(0, 0, - operand2); - LexicalUnitImpl operand3 = LexicalUnitImpl.createInteger(0, 0, - operatorMultiply, 3); - LexicalUnitImpl operatorMinus = LexicalUnitImpl.createMinus(0, 0, - operand3); - LexicalUnitImpl operand4 = LexicalUnitImpl.createInteger(0, 0, - operatorMinus, 4); - LexicalUnitImpl result = evaluator.evaluate(operand2); - Assert.assertEquals(2, result.getIntegerValue()); - } - - @Test - public void testPrecedenceDifferFromAppearOrder() { - // 2 - 3 * 4 = -10 - LexicalUnitImpl operand2 = LexicalUnitImpl.createInteger(0, 0, null, 2); - LexicalUnitImpl operatorMinus = LexicalUnitImpl.createMinus(0, 0, - operand2); - LexicalUnitImpl operand3 = LexicalUnitImpl.createInteger(0, 0, - operatorMinus, 3); - LexicalUnitImpl operatorMultiply = LexicalUnitImpl.createMultiply(0, 0, - operand3); - LexicalUnitImpl operand4 = LexicalUnitImpl.createInteger(0, 0, - operatorMultiply, 4); - LexicalUnitImpl result = evaluator.evaluate(operand2); - Assert.assertEquals(-10, result.getIntegerValue()); - } - - @Test(expected = IncompatibleUnitsException.class) - public void testIncompatibleUnit() { - // 2cm - 3px - LexicalUnitImpl operand2 = LexicalUnitImpl.createCM(0, 0, null, 2); - LexicalUnitImpl operatorMinus = LexicalUnitImpl.createMinus(0, 0, - operand2); - LexicalUnitImpl operand3 = LexicalUnitImpl.createPX(0, 0, - operatorMinus, 3); - evaluator.evaluate(operand2); - } - - @Test - public void testMultiplyWithUnitInfirstOperand() { - // 2cm * 3 = 6cm - LexicalUnitImpl operand2cm = LexicalUnitImpl.createCM(0, 0, null, 2); - LexicalUnitImpl operatorMultiply = LexicalUnitImpl.createMultiply(0, 0, - operand2cm); - LexicalUnitImpl operand3 = LexicalUnitImpl.createInteger(0, 0, - operatorMultiply, 3); - LexicalUnitImpl result = evaluator.evaluate(operand2cm); - Assert.assertEquals(6, result.getIntegerValue()); - Assert.assertEquals(LexicalUnit.SAC_CENTIMETER, - result.getLexicalUnitType()); - } - - @Test - public void testMultiplyWithUnitInSecondOperand() { - // 2 * 3cm = 6cm - LexicalUnitImpl operand2 = LexicalUnitImpl.createInteger(0, 0, null, 2); - LexicalUnitImpl operatorMultiply = LexicalUnitImpl.createMultiply(0, 0, - operand2); - LexicalUnitImpl operand3cm = LexicalUnitImpl.createCM(0, 0, - operatorMultiply, 3); - LexicalUnitImpl result = evaluator.evaluate(operand2); - Assert.assertEquals(6, result.getIntegerValue()); - Assert.assertEquals(LexicalUnit.SAC_CENTIMETER, - result.getLexicalUnitType()); - } - - @Test - public void testDivideWithSameUnit() { - // 4cm / 2cm = 2 - LexicalUnitImpl operand4cm = LexicalUnitImpl.createCM(0, 0, null, 4); - LexicalUnitImpl operatorDivide = LexicalUnitImpl.createSlash(0, 0, - operand4cm); - LexicalUnitImpl operand2cm = LexicalUnitImpl.createCM(0, 0, - operatorDivide, 2); - LexicalUnitImpl result = evaluator.evaluate(operand4cm); - Assert.assertEquals(2, result.getIntegerValue()); - Assert.assertEquals(LexicalUnit.SAC_REAL, result.getLexicalUnitType()); - } - - @Test - public void testDivideDenominatorWithoutUnit() { - // 4cm / 2 = 2cm - LexicalUnitImpl operand4cm = LexicalUnitImpl.createCM(0, 0, null, 4); - LexicalUnitImpl operatorDivide = LexicalUnitImpl.createSlash(0, 0, - operand4cm); - LexicalUnitImpl operand2 = LexicalUnitImpl.createInteger(0, 0, - operatorDivide, 2); - LexicalUnitImpl result = evaluator.evaluate(operand4cm); - Assert.assertEquals(2, result.getIntegerValue()); - Assert.assertEquals(LexicalUnit.SAC_CENTIMETER, - result.getLexicalUnitType()); - } - - @Test(expected = ArithmeticException.class) - public void testNonExistingSignal() { - LexicalUnitImpl operand2Integer = LexicalUnitImpl.createInteger(2, 3, - null, 2); - LexicalUnitImpl operatorComma = LexicalUnitImpl.createComma(2, 3, - operand2Integer); - LexicalUnitImpl operand3Integer = LexicalUnitImpl.createInteger(2, 3, - operatorComma, 3); - LexicalUnitImpl result = evaluator.evaluate(operand2Integer); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/internal/util/StringUtilTest.java b/theme-compiler/tests/src/com/vaadin/sass/internal/util/StringUtilTest.java deleted file mode 100644 index 84d189d8ba..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/internal/util/StringUtilTest.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.vaadin.sass.internal.util; - -import org.junit.Assert; -import org.junit.Test; - -public class StringUtilTest { - - @Test - public void testContainsVariable() { - String sentence = "$var1 var2"; - String word = "var"; - Assert.assertFalse(StringUtil.containsVariable(sentence, word)); - - word = "var1"; - Assert.assertTrue(StringUtil.containsVariable(sentence, word)); - - String var2 = "var2"; - Assert.assertFalse(StringUtil.containsVariable(sentence, var2)); - } - - @Test - public void testContainsVariableWithDash() { - String sentence = "$var- var2"; - String word = "var"; - Assert.assertFalse(StringUtil.containsVariable(sentence, word)); - } - - @Test - public void testReplaceVariable() { - String sentence = "$var1 var2"; - String word = "var"; - String value = "abc"; - Assert.assertEquals(sentence, - StringUtil.replaceVariable(sentence, word, value)); - - word = "var1"; - Assert.assertEquals("abc var2", - StringUtil.replaceVariable(sentence, word, value)); - - String var2 = "var2"; - Assert.assertEquals(sentence, - StringUtil.replaceVariable(sentence, var2, value)); - } - - @Test - public void testReplaceVariableWithDash() { - String sentence = "$var- var2"; - String word = "var"; - String value = "abc"; - Assert.assertEquals(sentence, - StringUtil.replaceVariable(sentence, word, value)); - } - - @Test - public void testContainsSubString() { - String sentence = "var1 var2"; - String word = "var"; - Assert.assertFalse(StringUtil.containsSubString(sentence, word)); - - word = "var1"; - Assert.assertTrue(StringUtil.containsSubString(sentence, word)); - - String var2 = "var2"; - Assert.assertTrue(StringUtil.containsSubString(sentence, var2)); - - Assert.assertTrue(StringUtil.containsSubString(".error.intrusion", - ".error")); - - Assert.assertFalse(StringUtil.containsSubString(".foo", "oo")); - } - - @Test - public void testContainsSubStringWithDash() { - String sentence = "var- var2"; - String word = "var"; - Assert.assertFalse(StringUtil.containsSubString(sentence, word)); - } - - @Test - public void testReplaceSubString() { - String sentence = "var1 var2"; - String word = "var"; - String value = "abc"; - - word = "var1"; - Assert.assertEquals("abc var2", - StringUtil.replaceSubString(sentence, word, value)); - - String var2 = "var1 abc"; - Assert.assertEquals(sentence, - StringUtil.replaceSubString(sentence, var2, value)); - - Assert.assertEquals(".foo", - StringUtil.replaceSubString(".foo", "oo", "aa")); - } - - @Test - public void testReplaceSubStringWithDash() { - String sentence = "var- var2"; - String word = "var"; - String value = "abc"; - Assert.assertEquals(sentence, - StringUtil.replaceSubString(sentence, word, value)); - } - - @Test - public void testRemoveDuplicatedClassSelector() { - Assert.assertEquals(".seriousError", StringUtil - .removeDuplicatedSubString(".seriousError.seriousError", ".")); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/parser/ParserTest.java b/theme-compiler/tests/src/com/vaadin/sass/parser/ParserTest.java deleted file mode 100644 index 1ed5075bd5..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/parser/ParserTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.parser; - -import java.io.IOException; -import java.io.StringReader; - -import org.junit.Assert; -import org.junit.Test; -import org.w3c.css.sac.CSSException; -import org.w3c.css.sac.InputSource; -import org.w3c.css.sac.LexicalUnit; - -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.parser.SCSSLexicalUnit; - -public class ParserTest { - - @Test - public void testParsePropertyValue() throws CSSException, IOException { - Parser parser = new Parser(); - - LexicalUnit value = parser.parsePropertyValue(new InputSource( - new StringReader("$margin/2;"))); - - Assert.assertEquals("margin", value.getStringValue()); - Assert.assertEquals(SCSSLexicalUnit.SCSS_VARIABLE, - value.getLexicalUnitType()); - value = value.getNextLexicalUnit(); - Assert.assertEquals(LexicalUnit.SAC_OPERATOR_SLASH, - value.getLexicalUnitType()); - value = value.getNextLexicalUnit(); - Assert.assertEquals(LexicalUnit.SAC_INTEGER, value.getLexicalUnitType()); - Assert.assertEquals(2, value.getIntegerValue()); - - } - - @Test - public void testCanIngoreSingleLineComment() { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - try { - parser.parseStyleSheet(new InputSource(new StringReader( - "//kjaljsföajsfalkj\n@12abcg;"))); - Assert.assertTrue(true); - } catch (Exception e) { - Assert.fail(e.getMessage()); - } - } -}
\ No newline at end of file diff --git a/theme-compiler/tests/src/com/vaadin/sass/resolvers/VaadinResolverTest.java b/theme-compiler/tests/src/com/vaadin/sass/resolvers/VaadinResolverTest.java deleted file mode 100644 index 0183142747..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/resolvers/VaadinResolverTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -/** - * - */ -package com.vaadin.sass.resolvers; - -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -import java.lang.reflect.Method; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.sass.internal.resolver.AbstractResolver; -import com.vaadin.sass.internal.resolver.ClassloaderResolver; -import com.vaadin.sass.internal.resolver.FilesystemResolver; - -public class VaadinResolverTest { - - @Test - public void testFilesystemResolverPathNormalization() throws Exception { - testPathNormalization(new FilesystemResolver()); - } - - @Test - public void testClassloaderResolverPathNormalization() throws Exception { - testPathNormalization(new ClassloaderResolver()); - } - - public void testPathNormalization(AbstractResolver resolver) - throws Exception { - - Method normalizeMethod = AbstractResolver.class.getDeclaredMethod( - "normalize", String.class); - normalizeMethod.setAccessible(true); - - String identifier, result; - - identifier = "a/b/../../../a b/b.scss"; - result = (String) normalizeMethod.invoke(resolver, identifier); - Assert.assertEquals("../a b/b.scss", result); - - identifier = "./a/b/../c/d/.././e.scss"; - result = (String) normalizeMethod.invoke(resolver, identifier); - Assert.assertEquals("a/c/e.scss", result); - - identifier = "/äåäåäääå/:;:;:;/???????/- -/e.scss"; - result = (String) normalizeMethod.invoke(resolver, identifier); - Assert.assertEquals("/äåäåäääå/:;:;:;/???????/- -/e.scss", result); - - identifier = "."; - result = (String) normalizeMethod.invoke(resolver, identifier); - Assert.assertEquals("", result); - - identifier = "../.."; - result = (String) normalizeMethod.invoke(resolver, identifier); - Assert.assertEquals("../..", result); - - identifier = "./../a.scss"; - result = (String) normalizeMethod.invoke(resolver, identifier); - Assert.assertEquals("../a.scss", result); - } - -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/EmptyBlock.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/css/EmptyBlock.java deleted file mode 100644 index 1ffce2b048..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/EmptyBlock.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.css; - -import java.io.IOException; -import java.net.URISyntaxException; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; - -public class EmptyBlock extends AbstractTestBase { - String css = "/basic/empty_block.css"; - - @Test - public void testParser() throws CSSException, URISyntaxException, - IOException { - testParser(css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Interpolation.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Interpolation.java deleted file mode 100644 index d823ccf860..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Interpolation.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.css; - -import java.io.IOException; -import java.net.URISyntaxException; - -import org.junit.Assert; -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.tree.BlockNode; - -public class Interpolation extends AbstractTestBase { - String scss = "/scss/interpolation.scss"; - - @Test - public void testParser() throws CSSException, URISyntaxException, - IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - - Assert.assertEquals(3, root.getChildren().size()); - BlockNode blockNodeWithInterpolation = (BlockNode) root.getChildren() - .get(2); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Media.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Media.java deleted file mode 100644 index b7ca325aa7..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Media.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.css; - -import java.io.IOException; -import java.net.URISyntaxException; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; - -public class Media extends AbstractTestBase { - - String css = "/basic/media.css"; - - @Test - public void testParser() throws CSSException, URISyntaxException, - IOException { - testParser(css); - } - -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Properties.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Properties.java deleted file mode 100644 index 2366dcab94..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Properties.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.css; - -import java.io.IOException; -import java.net.URISyntaxException; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; - -public class Properties extends AbstractTestBase { - - String css = "/basic/properties.css"; - - @Test - public void testParser() throws CSSException, URISyntaxException, - IOException { - testParser(css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Reindeer.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Reindeer.java deleted file mode 100644 index 758a6b398b..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Reindeer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.css; - -import java.io.IOException; -import java.net.URISyntaxException; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; - -public class Reindeer extends AbstractTestBase { - - String css = "/basic/reindeer.css"; - - @Test - public void testParser() throws CSSException, URISyntaxException, - IOException { - testParser(css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Selectors.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Selectors.java deleted file mode 100644 index 5ff8cf719a..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/css/Selectors.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.css; - -import java.io.IOException; -import java.net.URISyntaxException; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; - -public class Selectors extends AbstractTestBase { - - String css = "/basic/selectors.css"; - - @Test - public void testParser() throws CSSException, URISyntaxException, - IOException { - testParser(css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java deleted file mode 100644 index b9b80a7588..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.commons.io.IOUtils; -import org.junit.Assert; -import org.w3c.css.sac.CSSException; -import org.w3c.css.sac.CSSParseException; - -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.handler.SCSSErrorHandler; -import com.vaadin.sass.testcases.scss.SassTestRunner.FactoryTest; - -public abstract class AbstractDirectoryScanningSassTests { - - public static Collection<String> getScssResourceNames(URL directoryUrl) - throws URISyntaxException, IOException { - List<String> resources = new ArrayList<String>(); - for (String scssFile : getScssFiles(directoryUrl)) { - resources.add(scssFile); - } - return resources; - } - - private static List<String> getScssFiles(URL directoryUrl) - throws URISyntaxException, IOException { - URL sasslangUrl = directoryUrl; - File sasslangDir = new File(sasslangUrl.toURI()); - File scssDir = new File(sasslangDir, "scss"); - Assert.assertTrue(scssDir.exists()); - - List<File> scssFiles = new ArrayList<File>(); - addScssFilesRecursively(scssDir, scssFiles); - - List<String> scssRelativeNames = new ArrayList<String>(); - for (File f : scssFiles) { - String relativeName = f.getCanonicalPath().substring( - scssDir.getCanonicalPath().length() + 1); - scssRelativeNames.add(relativeName); - } - return scssRelativeNames; - } - - private static void addScssFilesRecursively(File scssDir, - List<File> scssFiles) { - for (File f : scssDir.listFiles()) { - if (f.isDirectory()) { - addScssFilesRecursively(f, scssFiles); - } else if (f.getName().endsWith(".scss") - && !f.getName().startsWith("_")) { - scssFiles.add(f); - } - } - } - - protected abstract URL getResourceURL(String path); - - @FactoryTest - public void compareScssWithCss(String scssResourceName) throws Exception { - File scssFile = getSassLangResourceFile(scssResourceName); - - SCSSDocumentHandler documentHandler = new SCSSDocumentHandlerImpl(); - SCSSErrorHandler errorHandler = new SCSSErrorHandler() { - @Override - public void error(CSSParseException arg0) throws CSSException { - super.error(arg0); - Assert.fail(arg0.getMessage()); - } - - @Override - public void fatalError(CSSParseException arg0) throws CSSException { - super.error(arg0); - Assert.fail(arg0.getMessage()); - } - }; - - ScssStylesheet scssStylesheet = ScssStylesheet.get( - scssFile.getCanonicalPath(), null, documentHandler, - errorHandler); - scssStylesheet.compile(); - String parsedCss = scssStylesheet.printState(); - - if (getCssFile(scssFile) != null) { - String referenceCss = IOUtils.toString(new FileInputStream( - getCssFile(scssFile))); - String normalizedReference = normalize(referenceCss); - String normalizedParsed = normalize(parsedCss); - - Assert.assertEquals("Original CSS and parsed CSS do not match for " - + scssResourceName, normalizedReference, normalizedParsed); - } - } - - private String normalize(String css) { - // Insert whitespace at each point - css = css.replaceAll("[\n\r\t ]*", " "); - // Replace multiple whitespace characters with a single space to compact - css = css.replaceAll("[\n\r\t ]+", " "); - // remove initial whitespace - css = css.replaceAll("^[\n\r\t ]*", ""); - // remove trailing whitespace - css = css.replaceAll("[\n\r\t ]*$", ""); - css = css.replaceAll(";", ";\n"); - css = css.replaceAll("\\{", "\\{\n"); - css = css.replaceAll("}", "}\n"); - return css; - } - - private File getSassLangResourceFile(String resourceName) - throws IOException, URISyntaxException { - String base = "/scss/"; - String fullResourceName = base + resourceName; - URL res = getResourceURL(fullResourceName); - if (res == null) { - throw new FileNotFoundException("Resource " + resourceName - + " not found (tried " + fullResourceName + ")"); - } - return new File(res.toURI()); - } - - protected File getCssFile(File scssFile) throws IOException { - return new File(scssFile.getCanonicalPath().replace("scss", "css")); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AutomaticSassTests.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AutomaticSassTests.java deleted file mode 100644 index 66e0bedac0..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AutomaticSassTests.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Collection; - -import org.junit.runner.RunWith; - -import com.vaadin.sass.testcases.scss.SassTestRunner.TestFactory; - -@RunWith(SassTestRunner.class) -public class AutomaticSassTests extends AbstractDirectoryScanningSassTests { - - @Override - protected URL getResourceURL(String path) { - return getResourceURLInternal(path); - } - - private static URL getResourceURLInternal(String path) { - return AutomaticSassTests.class.getResource("/automatic" + path); - } - - @TestFactory - public static Collection<String> getScssResourceNames() - throws URISyntaxException, IOException { - return getScssResourceNames(getResourceURLInternal("")); - } - -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Comments.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Comments.java deleted file mode 100644 index 6a09917d99..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Comments.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; -import java.net.URISyntaxException; - -import junit.framework.Assert; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.tree.CommentNode; - -public class Comments extends AbstractTestBase { - String scss = "/scss/comments.scss"; - String css = "/css/comments.css"; - - @Test - public void testParser() throws CSSException, URISyntaxException, - IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - Assert.assertNotNull(root); - Assert.assertEquals(6, root.getChildren().size()); - Assert.assertTrue(root.getChildren().get(1) instanceof CommentNode); - Assert.assertTrue(root.getChildren().get(2) instanceof CommentNode); - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/CompassImports.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/CompassImports.java deleted file mode 100644 index 02415dbe15..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/CompassImports.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.File; -import java.io.IOException; - -import junit.framework.Assert; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.resolver.FilesystemResolver; -import com.vaadin.sass.internal.tree.ImportNode; - -public class CompassImports extends AbstractTestBase { - - String scssOtherDirectory = "/scss/compass-test/compass-import.scss"; - String scssSameDirectory = "/scss/compass-test2/compass-import2.scss"; - String css = "/css/compass-import.css"; - - String compassPath = "/scss/compass-test2"; - - @Test - public void testParser() throws CSSException, IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scssOtherDirectory) - .getPath()); - ScssStylesheet root = handler.getStyleSheet(); - ImportNode importVariableNode = (ImportNode) root.getChildren().get(0); - Assert.assertEquals("compass", importVariableNode.getUri()); - Assert.assertFalse(importVariableNode.isPureCssImport()); - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scssSameDirectory, css, null); - } - - @Test - public void testCompilerWithCustomPath() throws Exception { - File rootPath = new File(getClass().getResource(compassPath).toURI()); - - testCompiler(scssOtherDirectory, css, rootPath.getPath()); - } - - public void testCompiler(String scss, String css, String additionalPath) - throws Exception { - comparisonCss = getFileContent(css); - comparisonCss = comparisonCss.replaceAll(CR, ""); - ScssStylesheet sheet = getStyleSheet(scss); - Assert.assertNotNull(sheet); - sheet.addResolver(new FilesystemResolver(additionalPath)); - - sheet.compile(); - parsedScss = sheet.printState(); - parsedScss = parsedScss.replaceAll(CR, ""); - Assert.assertEquals("Original CSS and parsed CSS do not match", - comparisonCss, parsedScss); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ControlDirectives.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ControlDirectives.java deleted file mode 100644 index 14cac4bb19..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ControlDirectives.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; -import java.util.ArrayList; - -import junit.framework.Assert; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.tree.BlockNode; -import com.vaadin.sass.internal.tree.MixinDefNode; -import com.vaadin.sass.internal.tree.MixinNode; -import com.vaadin.sass.internal.tree.Node; -import com.vaadin.sass.internal.tree.controldirective.EachDefNode; -import com.vaadin.sass.internal.tree.controldirective.IfElseDefNode; - -public class ControlDirectives extends AbstractTestBase { - - String scss = "/scss/control-directives.scss"; - String css = "/css/control-directives.css"; - - @Test - public void testParser() throws CSSException, IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - Assert.assertNotNull(root); - - ArrayList<Node> children = root.getChildren(); - Assert.assertEquals(8, root.getChildren().size()); - - Assert.assertTrue(children.get(1) instanceof MixinDefNode); - Assert.assertTrue(children.get(2) instanceof MixinNode); - Assert.assertTrue(children.get(3) instanceof BlockNode); - Assert.assertTrue(children.get(4) instanceof BlockNode); - Assert.assertTrue(children.get(5) instanceof BlockNode); - Assert.assertTrue(children.get(7) instanceof MixinDefNode); - - Assert.assertTrue(children.get(1).getChildren().get(0) instanceof EachDefNode); - Assert.assertTrue(children.get(3).getChildren().get(0) instanceof IfElseDefNode); - Assert.assertTrue(children.get(4).getChildren().get(0) instanceof IfElseDefNode); - Assert.assertTrue(!(children.get(7).getChildren().get(0) instanceof IfElseDefNode)); - - Assert.assertEquals(1, children.get(1).getChildren().size()); - - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Extends.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Extends.java deleted file mode 100644 index b3c20b0ab6..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Extends.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; -import java.net.URISyntaxException; - -import org.junit.Assert; -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.tree.ExtendNode; - -public class Extends extends AbstractTestBase { - String scss = "/scss/extends.scss"; - String css = "/css/extends.css"; - - @Test - public void testParser() throws CSSException, URISyntaxException, - IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - - Assert.assertTrue(root.getChildren().get(2).getChildren().get(0) instanceof ExtendNode); - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Functions.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Functions.java deleted file mode 100644 index bd214986c0..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Functions.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; - -import org.junit.Assert; -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.tree.BlockNode; - -public class Functions extends AbstractTestBase { - - String scss = "/scss/functions.scss"; - String css = "/css/functions.css"; - - @Test - public void testParser() throws CSSException, IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - Assert.assertEquals(6, root.getChildren().size()); - BlockNode blockNode = (BlockNode) root.getChildren().get(5); - Assert.assertEquals(17, blockNode.getChildren().size()); - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Imports.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Imports.java deleted file mode 100644 index aaa1a1439a..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Imports.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; - -import junit.framework.Assert; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.tree.ImportNode; - -public class Imports extends AbstractTestBase { - - String scss = "/scss/imports.scss"; - String css = "/css/imports.css"; - - @Test - public void testParser() throws CSSException, IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - ImportNode importNode = (ImportNode) root.getChildren().get(0); - Assert.assertEquals("_partial-for-import", importNode.getUri()); - Assert.assertFalse(importNode.isPureCssImport()); - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/MixinExtraParameters.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/MixinExtraParameters.java deleted file mode 100644 index 79c2ec366a..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/MixinExtraParameters.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.vaadin.sass.testcases.scss; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; - -public class MixinExtraParameters extends AbstractTestBase { - String scss = "/scss/mixin-extra-params.scss"; - - @Test - public void testCompiler() { - ScssStylesheet sheet; - try { - sheet = getStyleSheet(scss); - sheet.compile(); - } catch (RuntimeException e) { - Assert.assertEquals(e.getMessage(), - "More parameters than expected, in Mixin test"); - } catch (Exception e) { - Assert.fail(); - } - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Mixins.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Mixins.java deleted file mode 100644 index e4faee6e2a..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Mixins.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; -import java.net.URISyntaxException; - -import org.junit.Assert; -import org.junit.Test; -import org.w3c.css.sac.CSSException; -import org.w3c.css.sac.LexicalUnit; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.LexicalUnitImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.tree.BlockNode; -import com.vaadin.sass.internal.tree.MixinDefNode; -import com.vaadin.sass.internal.tree.MixinNode; - -public class Mixins extends AbstractTestBase { - - String scss = "/scss/mixins.scss"; - String css = "/css/mixins.css"; - - @Test - public void testParser() throws CSSException, URISyntaxException, - IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - - MixinDefNode mixinDefNode0 = (MixinDefNode) root.getChildren().get(0); - Assert.assertEquals("font-settings", mixinDefNode0.getName()); - Assert.assertTrue(mixinDefNode0.getArglist().isEmpty()); - Assert.assertEquals(3, mixinDefNode0.getChildren().size()); - - MixinDefNode mixinDefNode1 = (MixinDefNode) root.getChildren().get(1); - Assert.assertEquals("rounded-borders", mixinDefNode1.getName()); - Assert.assertEquals(2, mixinDefNode1.getArglist().size()); - Assert.assertEquals("thickness", mixinDefNode1.getArglist().get(0) - .getName()); - Assert.assertEquals("radius", mixinDefNode1.getArglist().get(1) - .getName()); - Assert.assertEquals(LexicalUnit.SAC_PIXEL, mixinDefNode1.getArglist() - .get(1).getExpr().getLexicalUnitType()); - Assert.assertEquals(3f, mixinDefNode1.getArglist().get(1).getExpr() - .getFloatValue(), 0f); - - Assert.assertEquals(4, mixinDefNode1.getChildren().size()); - - BlockNode mainBlockNode = (BlockNode) root.getChildren().get(3); - Assert.assertEquals(3, mainBlockNode.getChildren().size()); - MixinNode mixinNode0MainBlock = (MixinNode) mainBlockNode.getChildren() - .get(0); - Assert.assertEquals("rounded-borders", mixinNode0MainBlock.getName()); - Assert.assertEquals("mixinVar", mixinNode0MainBlock.getArglist().get(0) - .getStringValue()); - Assert.assertEquals(LexicalUnitImpl.SCSS_VARIABLE, mixinNode0MainBlock - .getArglist().get(0).getLexicalUnitType()); - MixinNode mixinNOde1MainBlock = (MixinNode) mainBlockNode.getChildren() - .get(1); - Assert.assertEquals("font-settings", mixinNOde1MainBlock.getName()); - Assert.assertTrue(mixinNOde1MainBlock.getArglist().isEmpty()); - - MixinNode mixinNOde2MainBlock = (MixinNode) mainBlockNode.getChildren() - .get(2); - Assert.assertEquals("main-details", mixinNOde2MainBlock.getName()); - Assert.assertTrue(mixinNOde1MainBlock.getArglist().isEmpty()); - - MixinNode mixinNode1MainBlock = (MixinNode) mainBlockNode.getChildren() - .get(1); - Assert.assertTrue(mixinNode1MainBlock.getArglist().isEmpty()); - - BlockNode footerBlockNode = (BlockNode) root.getChildren().get(3); - MixinNode mixinNodeFooterBlock = (MixinNode) footerBlockNode - .getChildren().get(0); - Assert.assertEquals("mixinVar", mixinNodeFooterBlock.getArglist() - .get(0).getStringValue()); - - Assert.assertTrue(root.getChildren().get(0) instanceof MixinDefNode); - Assert.assertTrue(root.getChildren().get(1) instanceof MixinDefNode); - Assert.assertTrue(root.getChildren().get(5) instanceof MixinDefNode); - Assert.assertTrue(root.getChildren().get(6) instanceof MixinDefNode); - Assert.assertTrue(root.getChildren().get(8) instanceof MixinDefNode); - Assert.assertTrue(root.getChildren().get(9) instanceof MixinNode); - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } - -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/NestedProperties.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/NestedProperties.java deleted file mode 100644 index 9a91df04ba..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/NestedProperties.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; - -import junit.framework.Assert; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.tree.BlockNode; -import com.vaadin.sass.internal.tree.NestPropertiesNode; -import com.vaadin.sass.internal.tree.RuleNode; - -public class NestedProperties extends AbstractTestBase { - String scss = "/scss/nested-properties.scss"; - String css = "/css/nested-properties.css"; - - @Test - public void testParser() throws CSSException, IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - Assert.assertEquals(1, root.getChildren().size()); - - BlockNode blockNode = (BlockNode) root.getChildren().get(0); - Assert.assertEquals(1, blockNode.getChildren().size()); - - NestPropertiesNode nestPropertiesNode = (NestPropertiesNode) blockNode - .getChildren().get(0); - Assert.assertEquals("font", nestPropertiesNode.getName()); - RuleNode nestedProperty0 = (RuleNode) nestPropertiesNode.getChildren() - .get(0); - RuleNode nestedProperty1 = (RuleNode) nestPropertiesNode.getChildren() - .get(1); - RuleNode nestedProperty2 = (RuleNode) nestPropertiesNode.getChildren() - .get(2); - Assert.assertEquals("family", nestedProperty0.getVariable()); - Assert.assertEquals("weight", nestedProperty1.getVariable()); - Assert.assertEquals("size", nestedProperty2.getVariable()); - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Nesting.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Nesting.java deleted file mode 100644 index 04aca5e8d3..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Nesting.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; - -import junit.framework.Assert; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.tree.BlockNode; - -public class Nesting extends AbstractTestBase { - - String scss = "/scss/nesting.scss"; - String css = "/css/nesting.css"; - - @Test - public void testParser() throws CSSException, IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - Assert.assertEquals(6, root.getChildren().size()); - - BlockNode blockNode0 = (BlockNode) root.getChildren().get(0); - Assert.assertEquals(2, blockNode0.getChildren().size()); - BlockNode nestedBlock0 = (BlockNode) blockNode0.getChildren().get(1); - org.junit.Assert.assertEquals(1, nestedBlock0.getChildren().size()); - - BlockNode blockNode1 = (BlockNode) root.getChildren().get(1); - Assert.assertEquals(2, blockNode1.getChildren().size()); - BlockNode nestedBlockInBlock1 = (BlockNode) blockNode1.getChildren() - .get(1); - Assert.assertEquals(1, nestedBlockInBlock1.getChildren().size()); - - BlockNode blockNode2 = (BlockNode) root.getChildren().get(2); - Assert.assertEquals(2, blockNode2.getChildren().size()); - BlockNode nestedBlockInBlock2 = (BlockNode) blockNode2.getChildren() - .get(1); - Assert.assertEquals(1, nestedBlockInBlock2.getChildren().size()); - - BlockNode blockNode3 = (BlockNode) root.getChildren().get(3); - Assert.assertEquals(2, blockNode3.getChildren().size()); - BlockNode nestedBlockInBlock3 = (BlockNode) blockNode3.getChildren() - .get(1); - Assert.assertEquals(2, nestedBlockInBlock3.getChildren().size()); - BlockNode nestednestedBlockInBlock3 = (BlockNode) nestedBlockInBlock3 - .getChildren().get(1); - Assert.assertEquals(1, nestednestedBlockInBlock3.getChildren().size()); - - BlockNode blockNode4 = (BlockNode) root.getChildren().get(4); - Assert.assertEquals(2, blockNode4.getChildren().size()); - BlockNode nestedBlockInBlock4 = (BlockNode) blockNode3.getChildren() - .get(1); - Assert.assertEquals(2, nestedBlockInBlock4.getChildren().size()); - BlockNode nestednestedBlockInBlock4 = (BlockNode) nestedBlockInBlock3 - .getChildren().get(1); - Assert.assertEquals(1, nestednestedBlockInBlock4.getChildren().size()); - - // the parsing of the last block is not checked in detail - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentImports.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentImports.java deleted file mode 100644 index daa7dbbf07..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentImports.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; - -import junit.framework.Assert; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.tree.ImportNode; - -public class ParentImports extends AbstractTestBase { - - String scss = "/scss/folder-test/parent-import.scss"; - String css = "/css/parent-import.css"; - - @Test - public void testParser() throws CSSException, IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - ImportNode importVariableNode = (ImportNode) root.getChildren().get(0); - Assert.assertEquals("../folder-test2/variables.scss", - importVariableNode.getUri()); - Assert.assertFalse(importVariableNode.isPureCssImport()); - - ImportNode importURLNode = (ImportNode) root.getChildren().get(1); - Assert.assertEquals("../folder-test2/url", importURLNode.getUri()); - Assert.assertFalse(importURLNode.isPureCssImport()); - - ImportNode importImportNode = (ImportNode) root.getChildren().get(2); - Assert.assertEquals("../folder-test2/base-imported.scss", - importImportNode.getUri()); - Assert.assertFalse(importImportNode.isPureCssImport()); - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java deleted file mode 100644 index 443d4a1086..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; - -import org.junit.Assert; -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.tree.BlockNode; - -public class ParentSelector extends AbstractTestBase { - String scss = "/scss/parent-selector.scss"; - String css = "/css/parent-selector.css"; - - @Test - public void testParser() throws CSSException, IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - BlockNode blockNode = (BlockNode) root.getChildren().get(0); - Assert.assertEquals(5, blockNode.getChildren().size()); - BlockNode nestedBlock1 = (BlockNode) blockNode.getChildren().get(3); - Assert.assertEquals("&:hover", nestedBlock1.getSelectorList().get(0)); - BlockNode nestedBlock2 = (BlockNode) blockNode.getChildren().get(4); - Assert.assertEquals("body.firefox &", nestedBlock2.getSelectorList() - .get(0)); - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTests.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTests.java deleted file mode 100644 index a8c9e80a3a..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTests.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Collection; - -import org.junit.runner.RunWith; - -import com.vaadin.sass.testcases.scss.SassTestRunner.TestFactory; - -@RunWith(SassTestRunner.class) -public class SassLangTests extends AbstractDirectoryScanningSassTests { - - @Override - protected URL getResourceURL(String path) { - return getResourceURLInternal(path); - } - - private static URL getResourceURLInternal(String path) { - URL url = SassLangTests.class.getResource("/sasslang" + path); - if (url == null) { - throw new RuntimeException( - "Could not locate /sasslang using classloader"); - } - return url; - } - - @TestFactory - public static Collection<String> getScssResourceNames() - throws URISyntaxException, IOException { - return getScssResourceNames(getResourceURLInternal("")); - } - -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTestsBroken.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTestsBroken.java deleted file mode 100644 index 0656565c20..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTestsBroken.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Collection; - -import org.junit.Assert; -import org.junit.runner.RunWith; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.testcases.scss.SassTestRunner.TestFactory; - -@RunWith(SassTestRunner.class) -public class SassLangTestsBroken extends AbstractDirectoryScanningSassTests { - - @Override - protected URL getResourceURL(String path) { - return getResourceURLInternal(path); - } - - private static URL getResourceURLInternal(String path) { - URL url = SassLangTestsBroken.class.getResource("/sasslangbroken" - + path); - if (url == null) { - throw new RuntimeException( - "Could not locate /sasslangbroken using classloader"); - } - return url; - } - - @TestFactory - public static Collection<String> getScssResourceNames() - throws URISyntaxException, IOException { - return getScssResourceNames(getResourceURLInternal("")); - } - - @Override - public void compareScssWithCss(String scssResourceName) throws Exception { - boolean success = false; - try { - super.compareScssWithCss(scssResourceName); - success = true; - } catch (CSSException e) { - // this is an expected outcome - } catch (AssertionError e) { - // this is an expected outcome - } - if (success) { - Assert.fail("Test " - + scssResourceName - + " from sasslangbroken that was expected to fail has been fixed. Please move the corresponding CSS and SCSS files to sasslang."); - } - } - -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassTestRunner.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassTestRunner.java deleted file mode 100644 index 147362e4c7..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassTestRunner.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import org.junit.runners.BlockJUnit4ClassRunner; -import org.junit.runners.Parameterized; -import org.junit.runners.model.FrameworkMethod; -import org.junit.runners.model.InitializationError; - -/** - * Test runner that executes methods annotated with @{@link FactoryTest} with - * all the values returned by a method annotated with @{@link TestFactory} as - * their parameters parameter. - * - * This runner is loosely based on FactoryTestRunner by Ted Young - * (http://tedyoung.me/2011/01/23/junit-runtime-tests-custom-runners/). The - * generated test names give information about the parameters used (unlike - * {@link Parameterized}). - * - * @since 7.0 - */ -public class SassTestRunner extends BlockJUnit4ClassRunner { - - @Target(ElementType.METHOD) - @Retention(RetentionPolicy.RUNTIME) - public @interface TestFactory { - } - - @Target(ElementType.METHOD) - @Retention(RetentionPolicy.RUNTIME) - public @interface FactoryTest { - } - - public SassTestRunner(Class<?> klass) throws InitializationError { - super(klass); - } - - @Override - protected List<FrameworkMethod> computeTestMethods() { - List<FrameworkMethod> tests = new LinkedList<FrameworkMethod>(); - - // Final all methods in our test class marked with @TestFactory. - for (FrameworkMethod method : getTestClass().getAnnotatedMethods( - TestFactory.class)) { - // Make sure the TestFactory method is static - if (!Modifier.isStatic(method.getMethod().getModifiers())) { - throw new IllegalArgumentException("TestFactory " + method - + " must be static."); - } - - // Execute the method (statically) - Object params; - try { - params = method.getMethod().invoke( - getTestClass().getJavaClass()); - } catch (Throwable t) { - throw new RuntimeException("Could not run test factory method " - + method.getName(), t); - } - - // Did the factory return an array? If so, make it a list. - if (params.getClass().isArray()) { - params = Arrays.asList((Object[]) params); - } - - // Did the factory return a scalar object? If so, put it in a list. - if (!(params instanceof Iterable<?>)) { - params = Collections.singletonList(params); - } - - // For each object returned by the factory. - for (Object param : (Iterable<?>) params) { - // Find any methods marked with @SassTest. - for (FrameworkMethod m : getTestClass().getAnnotatedMethods( - FactoryTest.class)) { - tests.add(new ParameterizedFrameworkMethod(m.getMethod(), - new Object[] { param })); - } - } - } - - return tests; - } - - private static class ParameterizedFrameworkMethod extends FrameworkMethod { - private Object[] params; - - public ParameterizedFrameworkMethod(Method method, Object[] params) { - super(method); - this.params = params; - } - - @Override - public Object invokeExplosively(Object target, Object... params) - throws Throwable { - // Executes the test method with the supplied parameters (returned - // by the - // TestFactory) and not the instance generated by FrameworkMethod. - return super.invokeExplosively(target, this.params); - } - - @Override - public String getName() { - return String.format("%s[%s]", getMethod().getName(), - Arrays.toString(params)); - } - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/VariableGuarded.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/VariableGuarded.java deleted file mode 100644 index a0727736e4..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/VariableGuarded.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; - -import junit.framework.Assert; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; - -public class VariableGuarded extends AbstractTestBase { - String scss = "/scss/var-guarded.scss"; - String css = "/css/var-guarded.css"; - - @Test - public void testParser() throws CSSException, IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - Assert.assertEquals(4, root.getChildren().size()); - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Variables.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Variables.java deleted file mode 100644 index 7f71d46f0d..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Variables.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; - -import junit.framework.Assert; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; -import com.vaadin.sass.internal.ScssStylesheet; -import com.vaadin.sass.internal.handler.SCSSDocumentHandler; -import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl; -import com.vaadin.sass.internal.parser.Parser; -import com.vaadin.sass.internal.parser.SCSSLexicalUnit; -import com.vaadin.sass.internal.tree.BlockNode; -import com.vaadin.sass.internal.tree.RuleNode; -import com.vaadin.sass.internal.tree.VariableNode; - -public class Variables extends AbstractTestBase { - - String scss = "/scss/variables.scss"; - String css = "/css/variables.css"; - - @Test - public void testParser() throws CSSException, IOException { - Parser parser = new Parser(); - SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl(); - parser.setDocumentHandler(handler); - parser.parseStyleSheet(getClass().getResource(scss).getPath()); - ScssStylesheet root = handler.getStyleSheet(); - Assert.assertEquals(6, root.getChildren().size()); - - VariableNode varNode1 = (VariableNode) root.getChildren().get(0); - Assert.assertEquals("blue", varNode1.getName()); - - VariableNode varNode3 = (VariableNode) root.getChildren().get(2); - Assert.assertEquals("chameleon-font-family", varNode3.getName()); - - VariableNode varNode2 = (VariableNode) root.getChildren().get(1); - Assert.assertEquals("margin", varNode2.getName()); - Assert.assertEquals(8f, varNode2.getExpr().getFloatValue()); - Assert.assertEquals("px", varNode2.getExpr().getDimensionUnitText()); - - BlockNode blockNode1 = (BlockNode) root.getChildren().get(5); - Assert.assertEquals(3, blockNode1.getChildren().size()); - RuleNode ruleNode1Block1 = (RuleNode) blockNode1.getChildren().get(2); - Assert.assertEquals("border-color", ruleNode1Block1.getVariable()); - Assert.assertEquals(SCSSLexicalUnit.SCSS_VARIABLE, ruleNode1Block1 - .getValue().getLexicalUnitType()); - Assert.assertEquals("blue", ruleNode1Block1.getValue().getStringValue()); - - RuleNode ruleNode2Block1 = (RuleNode) blockNode1.getChildren().get(2); - Assert.assertEquals("border-color", ruleNode2Block1.getVariable()); - Assert.assertEquals(SCSSLexicalUnit.SCSS_VARIABLE, ruleNode2Block1 - .getValue().getLexicalUnitType()); - Assert.assertEquals("blue", ruleNode2Block1.getValue().getStringValue()); - - BlockNode blockNode2 = (BlockNode) root.getChildren().get(5); - RuleNode ruleNode1Block2 = (RuleNode) blockNode2.getChildren().get(0); - Assert.assertEquals("padding", ruleNode1Block2.getVariable()); - Assert.assertEquals(SCSSLexicalUnit.SCSS_VARIABLE, ruleNode1Block2 - .getValue().getLexicalUnitType()); - Assert.assertEquals("margin", ruleNode1Block2.getValue() - .getStringValue()); - - RuleNode ruleNode2Block2 = (RuleNode) blockNode2.getChildren().get(1); - Assert.assertEquals("margin", ruleNode2Block2.getVariable()); - Assert.assertEquals(SCSSLexicalUnit.SCSS_VARIABLE, ruleNode2Block2 - .getValue().getLexicalUnitType()); - Assert.assertEquals("margin", ruleNode2Block2.getValue() - .getStringValue()); - - RuleNode ruleNode3Block2 = (RuleNode) blockNode2.getChildren().get(2); - Assert.assertEquals("border-color", ruleNode3Block2.getVariable()); - Assert.assertEquals(SCSSLexicalUnit.SCSS_VARIABLE, ruleNode1Block2 - .getValue().getLexicalUnitType()); - Assert.assertEquals("blue", ruleNode3Block2.getValue().getStringValue()); - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/W3ConformanceTests.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/W3ConformanceTests.java deleted file mode 100644 index 8dbc6345d6..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/W3ConformanceTests.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.sass.testcases.scss; - -import java.io.File; -import java.io.IOException; -import java.io.PrintStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; - -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.io.IOUtils; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; -import org.jsoup.select.Elements; -import org.junit.runner.RunWith; - -import com.vaadin.sass.testcases.scss.SassTestRunner.TestFactory; - -@RunWith(SassTestRunner.class) -public class W3ConformanceTests extends AbstractDirectoryScanningSassTests { - - @Override - protected URL getResourceURL(String path) { - return getResourceURLInternal(path); - } - - private static URL getResourceURLInternal(String path) { - return AutomaticSassTests.class.getResource("/w3ctests" + path); - } - - @TestFactory - public static Collection<String> getScssResourceNames() - throws URISyntaxException, IOException { - return getScssResourceNames(getResourceURLInternal("")); - } - - @Override - protected File getCssFile(File scssFile) throws IOException { - /* - * We should really compare the result of unparse(parse(css)) to css, - * but the comparator routine is currently too primitive. - */ - // return scssFile; - - // no comparison step, just parse, in this test - return null; - } - - /* - * Download W3C conformance tests for CSS 2.1 and CSS 3 (selectors), - * extracts all CSS (style tags, inline styles, and linked stylesheets), - * then tries to parse them. Since each CSS is valid SCSS, the parser should - * accept them. As these are browser tests, some are intentionally - * malformed, and must be excluded from the test suite. - */ - - public static void main(String[] args) throws Exception { - if (args.length < 1) { - System.err.println("Target directory not provided"); - return; - } - File targetDir = new File(args[0]); - for (URI url : CSS21()) { - extractCSS(url, targetDir); - } - for (URI url : CSS3Selectors()) { - extractCSS(url, targetDir); - } - - } - - public static Collection<URI> CSS21() throws Exception { - /* - * Tests explicitly excluded are listed below---case by case motivation - * required! - */ - final String[] excludelist = new String[] { - // Unsupported character encoding UTF-16 - "http://test.csswg.org/suites/css2.1/20110323/html4/at-charset-utf16-be-002.htm", - "http://test.csswg.org/suites/css2.1/20110323/html4/at-charset-utf16-be-003.htm", - "http://test.csswg.org/suites/css2.1/20110323/html4/at-charset-utf16-le-002.htm", - "http://test.csswg.org/suites/css2.1/20110323/html4/at-charset-utf16-le-003.htm", - - // Font family name contains (Asian?) cryptoglyphs - "http://test.csswg.org/suites/css2.1/20110323/html4/font-family-name-010.htm", - "http://test.csswg.org/suites/css2.1/20110323/html4/font-family-name-011.htm", - "http://test.csswg.org/suites/css2.1/20110323/html4/font-family-name-015.htm", - - // Contains syntactically illegal CSS - "http://test.csswg.org/suites/css2.1/20110323/html4/uri-013.htm", - - // Missing semicolon on line 29 - "http://test.csswg.org/suites/css2.1/20110323/html4/z-index-020.htm", }; - - // Note: W3C test reference files also not included! - return scrapeIndexForTests( - "http://test.csswg.org/suites/css2.1/20110323/html4/reftest-toc.html", - ".*[0-9][0-9][0-9][a-z]?\\.htm", Integer.MAX_VALUE, - new LinkedHashSet<URI>() { - { - for (String s : excludelist) { - add(new URI(s)); - } - } - }); - } - - public static Collection<URI> CSS3Selectors() throws Exception { - /* - * Tests explicitly excluded are listed below---case by case motivation - * required! - */ - final String[] excludelist = new String[] { - - // Probable bug/limitation (filed as #12834) - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-73.html", - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-73b.html", - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-74.html", - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-74b.html", - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-75.html", - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-75b.html", - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-76.html", - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-76b.html", - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-83.html", - - // Invalid CSS, although sass-lang compiler accepts (see #12835) - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-154.html", - - // Invalid CSS? sass-lang compiler fails - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-157.html", - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-158.html", - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-183.html", }; - - return scrapeIndexForTests( - "http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/", - "css3-.*\\.html", Integer.MAX_VALUE, new LinkedHashSet<URI>() { - { - for (String s : excludelist) { - add(new URI(s)); - } - } - }); - } - - /* - * Loads up to maxTest tests, excluding any URL in excludeUrls. - */ - protected static Collection<URI> scrapeIndexForTests(String url, - String regexp, int maxTests, Collection<URI> excludeUrls) - throws Exception { - - URI baseUrl = new URI(url); - Document doc = Jsoup.connect(url).timeout(10000).get(); - Elements elems = doc.select(String.format("a[href~=%s]", regexp)); - LinkedHashSet<URI> tests = new LinkedHashSet<URI>(); - for (Element e : elems) { - URI testUrl = new URI(e.attr("href")); - if (!testUrl.isAbsolute()) { - testUrl = baseUrl.resolve(testUrl); - } - if (tests.size() < maxTests) { - if (!excludeUrls.contains(testUrl)) { - tests.add(testUrl); - } - } else { - break; - } - } - - return tests; - } - - public static void extractCSS(final URI url, File targetdir) - throws Exception { - /* - * For each test URL: 1) extract <style> tag contents 2) extract from - * <link rel="stylesheet"> files 3) extract inline style attributes from - * all elements and wrap the result in .style {} - */ - - Document doc = Jsoup.connect(url.toString()).timeout(20000).get(); - - List<String> tests = new ArrayList<String>(); - - for (Element e : doc.select("style[type=text/css]")) { - tests.add(e.data()); - } - - for (Element e : doc - .select("link[rel=stylesheet][href][type=text/css]")) { - URI cssUri = new URI(e.attr("href")); - if (!cssUri.isAbsolute()) { - cssUri = url.resolve(cssUri); - } - String encoding = doc.outputSettings().charset().name(); - tests.add(IOUtils.toString(cssUri, encoding)); - } - - for (Element e : doc.select("*[style]")) { - tests.add(String.format(".style { %s }", e.attr("style"))); - } - - for (final String test : tests) { - targetdir.mkdirs(); - String logfile = String.format("%s.%d.scss", - FilenameUtils.getBaseName(url.toString()), - tests.indexOf(test)); - PrintStream dataLogger = new PrintStream(new File(targetdir, - logfile)); - - dataLogger.println("/* Source: " + url + " */"); - dataLogger.println(test); - - } - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/tree/ImportNodeTest.java b/theme-compiler/tests/src/com/vaadin/sass/tree/ImportNodeTest.java deleted file mode 100644 index a7cf442966..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/tree/ImportNodeTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.sass.tree; - -import org.junit.Assert; -import org.junit.Test; - -import com.steadystate.css.parser.SACMediaListImpl; -import com.vaadin.sass.internal.tree.ImportNode; - -public class ImportNodeTest { - @Test - public void testIsPureCssImportShouldReturnTrueWhenIsURL() { - ImportNode node = new ImportNode("", null, true); - Assert.assertTrue(node.isPureCssImport()); - } - - @Test - public void testIsPureCssImportShouldReturnTrueWhenStartsWithHttp() { - ImportNode node = new ImportNode("http://abc", null, false); - Assert.assertTrue(node.isPureCssImport()); - } - - @Test - public void testIsPureCssImportShouldReturnTrueWhenEndsWithCss() { - ImportNode node = new ImportNode("abc.css", null, false); - Assert.assertTrue(node.isPureCssImport()); - } - - @Test - public void testIsPureCssImportShouldReturnTrueWhenHasMediaQueries() { - SACMediaListImpl ml = new SACMediaListImpl(); - ml.add("screen"); - ImportNode node = new ImportNode("", ml, false); - Assert.assertTrue(node.isPureCssImport()); - } - - @Test - public void testIsPureCssImportShouldReturnFalseInOtherCases() { - ImportNode node = new ImportNode("", null, false); - Assert.assertFalse(node.isPureCssImport()); - } - - @Test - public void testSerializeWhenIsURL() { - ImportNode node = new ImportNode("test", null, true); - Assert.assertEquals("@import url(test);", node.printState()); - } - - @Test - public void testSerializeWhenIsNotURL() { - ImportNode node = new ImportNode("test", null, false); - Assert.assertEquals("@import \"test\";", node.printState()); - } - - @Test - public void testSerializeWithMediaQueries() { - SACMediaListImpl ml = new SACMediaListImpl(); - ml.add("screen"); - ImportNode node = new ImportNode("test", ml, true); - Assert.assertEquals("@import url(test) screen;", node.printState()); - } -} |