From e8ef66d2d6dde9cb1b9b0fa0df24643c1e0f6f26 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Tue, 27 Nov 2012 11:14:57 +0200 Subject: Move some SCSS tests to be scanned automatically Change-Id: I7590c6cd20f649a5c02e92673d44cf1c2721b95d --- .../tests/resources/automatic/css/listmodify.css | 23 +++++++++++ .../automatic/css/microsoft-extensions.css | 6 +++ .../resources/automatic/css/remove-directive.css | 39 ++++++++++++++++++ .../tests/resources/automatic/css/semicolons.css | 10 +++++ .../tests/resources/automatic/scss/listmodify.scss | 25 +++++++++++ .../automatic/scss/microsoft-extensions.scss | 6 +++ .../resources/automatic/scss/remove-directive.scss | 24 +++++++++++ .../tests/resources/automatic/scss/semicolons.scss | 9 ++++ theme-compiler/tests/resources/css/listmodify.css | 23 ----------- .../tests/resources/css/microsoft-extensions.css | 6 --- .../tests/resources/css/remove-directive.css | 39 ------------------ theme-compiler/tests/resources/css/semicolons.css | 10 ----- .../tests/resources/scss/listmodify.scss | 25 ----------- .../tests/resources/scss/microsoft-extensions.scss | 6 --- .../tests/resources/scss/remove-directive.scss | 24 ----------- .../tests/resources/scss/semicolons.scss | 9 ---- .../sass/testcases/scss/AutomaticSassTests.java | 48 ++++++++++++++++++++++ .../com/vaadin/sass/testcases/scss/ListModify.java | 17 -------- .../sass/testcases/scss/MicrosoftExtensions.java | 34 --------------- .../sass/testcases/scss/RemoveDirective.java | 25 ----------- .../com/vaadin/sass/testcases/scss/Semicolons.java | 34 --------------- 21 files changed, 190 insertions(+), 252 deletions(-) create mode 100644 theme-compiler/tests/resources/automatic/css/listmodify.css create mode 100644 theme-compiler/tests/resources/automatic/css/microsoft-extensions.css create mode 100644 theme-compiler/tests/resources/automatic/css/remove-directive.css create mode 100644 theme-compiler/tests/resources/automatic/css/semicolons.css create mode 100644 theme-compiler/tests/resources/automatic/scss/listmodify.scss create mode 100644 theme-compiler/tests/resources/automatic/scss/microsoft-extensions.scss create mode 100644 theme-compiler/tests/resources/automatic/scss/remove-directive.scss create mode 100644 theme-compiler/tests/resources/automatic/scss/semicolons.scss delete mode 100644 theme-compiler/tests/resources/css/listmodify.css delete mode 100644 theme-compiler/tests/resources/css/microsoft-extensions.css delete mode 100644 theme-compiler/tests/resources/css/remove-directive.css delete mode 100644 theme-compiler/tests/resources/css/semicolons.css delete mode 100644 theme-compiler/tests/resources/scss/listmodify.scss delete mode 100644 theme-compiler/tests/resources/scss/microsoft-extensions.scss delete mode 100644 theme-compiler/tests/resources/scss/remove-directive.scss delete mode 100644 theme-compiler/tests/resources/scss/semicolons.scss create mode 100644 theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AutomaticSassTests.java delete mode 100644 theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ListModify.java delete mode 100644 theme-compiler/tests/src/com/vaadin/sass/testcases/scss/MicrosoftExtensions.java delete mode 100644 theme-compiler/tests/src/com/vaadin/sass/testcases/scss/RemoveDirective.java delete mode 100644 theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Semicolons.java (limited to 'theme-compiler') diff --git a/theme-compiler/tests/resources/automatic/css/listmodify.css b/theme-compiler/tests/resources/automatic/css/listmodify.css new file mode 100644 index 0000000000..b07d5d9eef --- /dev/null +++ b/theme-compiler/tests/resources/automatic/css/listmodify.css @@ -0,0 +1,23 @@ +.v-button { + font-size: 12px; +} + +.v-label { + font-size: 12px; +} + +.v-button { + font-color: red; +} + +.v-label { + font-color: red; +} + +.v-textfield { + font-color: red; +} + +.v-button { + background-color: black; +} \ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/css/microsoft-extensions.css b/theme-compiler/tests/resources/automatic/css/microsoft-extensions.css new file mode 100644 index 0000000000..18bc34ca6c --- /dev/null +++ b/theme-compiler/tests/resources/automatic/css/microsoft-extensions.css @@ -0,0 +1,6 @@ +.v-ie6 .v-shadow-window { + background: #000000; + filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=5 ) alpha(opacity = 20); + margin-top: 2px; + margin-left: 2px; +} \ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/css/remove-directive.css b/theme-compiler/tests/resources/automatic/css/remove-directive.css new file mode 100644 index 0000000000..1e6d41c128 --- /dev/null +++ b/theme-compiler/tests/resources/automatic/css/remove-directive.css @@ -0,0 +1,39 @@ +.animals .platypus-icon { + background-image: url('/images/platypus.png'); +} + +.animals .rhinoceros-icon { + background-image: url('/images/rhinoceros.png'); +} + +.animals .llama-icon { + background-image: url('/images/llama.png'); +} + +.animals .duck-icon { + background-image: url('/images/duck.png'); +} + +.animals .duck-icon { + background-image: url('/images/duck.png'); +} + +.exotic-animals .platypus-icon { + background-image: url('/images/platypus.png'); +} + +.exotic-animals .rhinoceros-icon { + background-image: url('/images/rhinoceros.png'); +} + +.exotic-animals .llama-icon { + background-image: url('/images/llama.png'); +} + +.ball { + font-size: 12px; +} + +.cube { + font-size: 12px; +} \ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/css/semicolons.css b/theme-compiler/tests/resources/automatic/css/semicolons.css new file mode 100644 index 0000000000..ba28e8cab4 --- /dev/null +++ b/theme-compiler/tests/resources/automatic/css/semicolons.css @@ -0,0 +1,10 @@ +.all-the-properties { + font-family: Arial, Helvetica, "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; + position: absolute; + overflow: hidden; +} + +.missing-semicolon-on-last-row { + color: red; + background-color: blue; +} \ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/scss/listmodify.scss b/theme-compiler/tests/resources/automatic/scss/listmodify.scss new file mode 100644 index 0000000000..814f3156f8 --- /dev/null +++ b/theme-compiler/tests/resources/automatic/scss/listmodify.scss @@ -0,0 +1,25 @@ +$list : .v-button, .v-panel, .v-label; + +$basics : remove($list, .v-panel); + +@each $component in $basics{ + .#{$component} { + font-size: 12px; + } +} + +$items : append($basics, .v-textfield); + +@each $component in $items{ + .#{$component} { + font-color: red; + } +} + +$contains : contains($items, .v-button); + +@if($contains){ + .v-button { + background-color: black; + } +} diff --git a/theme-compiler/tests/resources/automatic/scss/microsoft-extensions.scss b/theme-compiler/tests/resources/automatic/scss/microsoft-extensions.scss new file mode 100644 index 0000000000..69670969de --- /dev/null +++ b/theme-compiler/tests/resources/automatic/scss/microsoft-extensions.scss @@ -0,0 +1,6 @@ +.v-ie6 .v-shadow-window { + background: #000000; + filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=5 ) alpha(opacity = 20); + margin-top: 2px; + margin-left: 2px; +} diff --git a/theme-compiler/tests/resources/automatic/scss/remove-directive.scss b/theme-compiler/tests/resources/automatic/scss/remove-directive.scss new file mode 100644 index 0000000000..ca9a19522f --- /dev/null +++ b/theme-compiler/tests/resources/automatic/scss/remove-directive.scss @@ -0,0 +1,24 @@ +$animals : platypus, rhinoceros, llama, duck, duck; +$remove : duck; + +@each $animal in $animals { + .animals .#{$animal}-icon { + background-image: url('/images/#{$animal}.png'); + } +} + +$exotic : remove($animals, $remove, space); + +@each $animal in $exotic{ + .exotic-animals .#{$animal}-icon { + background-image: url('/images/#{$animal}.png'); + } +} + +$things : remove((ball,cube,duck), duck); + +@each $thing in $things{ + .#{$thing}{ + font-size: 12px; + } +} \ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/scss/semicolons.scss b/theme-compiler/tests/resources/automatic/scss/semicolons.scss new file mode 100644 index 0000000000..a4a56043d5 --- /dev/null +++ b/theme-compiler/tests/resources/automatic/scss/semicolons.scss @@ -0,0 +1,9 @@ +.all-the-properties { + font-family: Arial, Helvetica, "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; ; + position: absolute;; + overflow: hidden; +} +.missing-semicolon-on-last-row { + color: red; + background-color: blue +} diff --git a/theme-compiler/tests/resources/css/listmodify.css b/theme-compiler/tests/resources/css/listmodify.css deleted file mode 100644 index b07d5d9eef..0000000000 --- a/theme-compiler/tests/resources/css/listmodify.css +++ /dev/null @@ -1,23 +0,0 @@ -.v-button { - font-size: 12px; -} - -.v-label { - font-size: 12px; -} - -.v-button { - font-color: red; -} - -.v-label { - font-color: red; -} - -.v-textfield { - font-color: red; -} - -.v-button { - background-color: black; -} \ No newline at end of file diff --git a/theme-compiler/tests/resources/css/microsoft-extensions.css b/theme-compiler/tests/resources/css/microsoft-extensions.css deleted file mode 100644 index 18bc34ca6c..0000000000 --- a/theme-compiler/tests/resources/css/microsoft-extensions.css +++ /dev/null @@ -1,6 +0,0 @@ -.v-ie6 .v-shadow-window { - background: #000000; - filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=5 ) alpha(opacity = 20); - margin-top: 2px; - margin-left: 2px; -} \ No newline at end of file diff --git a/theme-compiler/tests/resources/css/remove-directive.css b/theme-compiler/tests/resources/css/remove-directive.css deleted file mode 100644 index 1e6d41c128..0000000000 --- a/theme-compiler/tests/resources/css/remove-directive.css +++ /dev/null @@ -1,39 +0,0 @@ -.animals .platypus-icon { - background-image: url('/images/platypus.png'); -} - -.animals .rhinoceros-icon { - background-image: url('/images/rhinoceros.png'); -} - -.animals .llama-icon { - background-image: url('/images/llama.png'); -} - -.animals .duck-icon { - background-image: url('/images/duck.png'); -} - -.animals .duck-icon { - background-image: url('/images/duck.png'); -} - -.exotic-animals .platypus-icon { - background-image: url('/images/platypus.png'); -} - -.exotic-animals .rhinoceros-icon { - background-image: url('/images/rhinoceros.png'); -} - -.exotic-animals .llama-icon { - background-image: url('/images/llama.png'); -} - -.ball { - font-size: 12px; -} - -.cube { - font-size: 12px; -} \ No newline at end of file diff --git a/theme-compiler/tests/resources/css/semicolons.css b/theme-compiler/tests/resources/css/semicolons.css deleted file mode 100644 index ba28e8cab4..0000000000 --- a/theme-compiler/tests/resources/css/semicolons.css +++ /dev/null @@ -1,10 +0,0 @@ -.all-the-properties { - font-family: Arial, Helvetica, "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; - position: absolute; - overflow: hidden; -} - -.missing-semicolon-on-last-row { - color: red; - background-color: blue; -} \ No newline at end of file diff --git a/theme-compiler/tests/resources/scss/listmodify.scss b/theme-compiler/tests/resources/scss/listmodify.scss deleted file mode 100644 index 814f3156f8..0000000000 --- a/theme-compiler/tests/resources/scss/listmodify.scss +++ /dev/null @@ -1,25 +0,0 @@ -$list : .v-button, .v-panel, .v-label; - -$basics : remove($list, .v-panel); - -@each $component in $basics{ - .#{$component} { - font-size: 12px; - } -} - -$items : append($basics, .v-textfield); - -@each $component in $items{ - .#{$component} { - font-color: red; - } -} - -$contains : contains($items, .v-button); - -@if($contains){ - .v-button { - background-color: black; - } -} diff --git a/theme-compiler/tests/resources/scss/microsoft-extensions.scss b/theme-compiler/tests/resources/scss/microsoft-extensions.scss deleted file mode 100644 index 69670969de..0000000000 --- a/theme-compiler/tests/resources/scss/microsoft-extensions.scss +++ /dev/null @@ -1,6 +0,0 @@ -.v-ie6 .v-shadow-window { - background: #000000; - filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=5 ) alpha(opacity = 20); - margin-top: 2px; - margin-left: 2px; -} diff --git a/theme-compiler/tests/resources/scss/remove-directive.scss b/theme-compiler/tests/resources/scss/remove-directive.scss deleted file mode 100644 index ca9a19522f..0000000000 --- a/theme-compiler/tests/resources/scss/remove-directive.scss +++ /dev/null @@ -1,24 +0,0 @@ -$animals : platypus, rhinoceros, llama, duck, duck; -$remove : duck; - -@each $animal in $animals { - .animals .#{$animal}-icon { - background-image: url('/images/#{$animal}.png'); - } -} - -$exotic : remove($animals, $remove, space); - -@each $animal in $exotic{ - .exotic-animals .#{$animal}-icon { - background-image: url('/images/#{$animal}.png'); - } -} - -$things : remove((ball,cube,duck), duck); - -@each $thing in $things{ - .#{$thing}{ - font-size: 12px; - } -} \ No newline at end of file diff --git a/theme-compiler/tests/resources/scss/semicolons.scss b/theme-compiler/tests/resources/scss/semicolons.scss deleted file mode 100644 index a4a56043d5..0000000000 --- a/theme-compiler/tests/resources/scss/semicolons.scss +++ /dev/null @@ -1,9 +0,0 @@ -.all-the-properties { - font-family: Arial, Helvetica, "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; ; - position: absolute;; - overflow: hidden; -} -.missing-semicolon-on-last-row { - color: red; - background-color: blue -} 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 new file mode 100644 index 0000000000..1e5ec1ad37 --- /dev/null +++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AutomaticSassTests.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 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.net.URISyntaxException; +import java.net.URL; +import java.util.Collection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class AutomaticSassTests extends AbstractDirectoryScanningSassTests { + + public AutomaticSassTests(String scssResourceName) { + super(scssResourceName); + } + + @Override + protected URL getResourceURL(String path) { + return getResourceURLInternal(path); + } + + private static URL getResourceURLInternal(String path) { + return AutomaticSassTests.class.getResource("/automatic" + path); + } + + @Parameters + public static Collection getScssResourceNames() + throws URISyntaxException { + return getScssResourceNames(getResourceURLInternal("")); + } + +} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ListModify.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ListModify.java deleted file mode 100644 index 4a65591f83..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ListModify.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.vaadin.sass.testcases.scss; - -import org.junit.Test; - -import com.vaadin.sass.AbstractTestBase; - -public class ListModify extends AbstractTestBase { - - String scss = "/scss/listmodify.scss"; - String css = "/css/listmodify.css"; - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } - -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/MicrosoftExtensions.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/MicrosoftExtensions.java deleted file mode 100644 index 5460700db4..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/MicrosoftExtensions.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2011 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 org.junit.Test; - -import com.vaadin.sass.AbstractTestBase; - -/** - * Test for Microsoft specific CSS extensions. - */ -public class MicrosoftExtensions extends AbstractTestBase { - String scss = "/scss/microsoft-extensions.scss"; - String css = "/css/microsoft-extensions.css"; - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/RemoveDirective.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/RemoveDirective.java deleted file mode 100644 index e9e87e7b56..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/RemoveDirective.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.vaadin.sass.testcases.scss; - -import java.io.IOException; - -import org.junit.Test; -import org.w3c.css.sac.CSSException; - -import com.vaadin.sass.AbstractTestBase; - -public class RemoveDirective extends AbstractTestBase { - - String scss = "/scss/remove-directive.scss"; - String css = "/css/remove-directive.css"; - - @Test - public void testParser() throws CSSException, IOException { - - } - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } - -} diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Semicolons.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Semicolons.java deleted file mode 100644 index 9dd8a38bfe..0000000000 --- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Semicolons.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2011 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 org.junit.Test; - -import com.vaadin.sass.AbstractTestBase; - -/** - * Test for missing and extraneous semicolon handling. - */ -public class Semicolons extends AbstractTestBase { - String scss = "/scss/semicolons.scss"; - String css = "/css/semicolons.css"; - - @Test - public void testCompiler() throws Exception { - testCompiler(scss, css); - } -} -- cgit v1.2.3