summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-06-13 09:03:15 +0000
committerLeif Åstrand <leif@vaadin.com>2012-06-13 09:03:15 +0000
commit6fc4fd79a6b96bcdd66058173e78beec3d9ce9ac (patch)
treed1b710408bd8da99dbcb26893122186e8b783bdf /tests
parent623628a1c0a579b9e1b7276a0475913e2e27d1cd (diff)
downloadvaadin-framework-6fc4fd79a6b96bcdd66058173e78beec3d9ce9ac.tar.gz
vaadin-framework-6fc4fd79a6b96bcdd66058173e78beec3d9ce9ac.zip
Change Chameleon -> chameleon + unit test for all builtin themes (#8386)
svn changeset:23930/svn branch:6.8
Diffstat (limited to 'tests')
-rw-r--r--tests/server-side/com/vaadin/tests/VaadinClasses.java10
-rw-r--r--tests/server-side/com/vaadin/tests/server/TestThemeNames.java38
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/server-side/com/vaadin/tests/VaadinClasses.java b/tests/server-side/com/vaadin/tests/VaadinClasses.java
index e02c4f0b6e..0baec576d9 100644
--- a/tests/server-side/com/vaadin/tests/VaadinClasses.java
+++ b/tests/server-side/com/vaadin/tests/VaadinClasses.java
@@ -28,6 +28,7 @@ import com.vaadin.ui.PopupView;
import com.vaadin.ui.SplitPanel;
import com.vaadin.ui.VerticalSplitPanel;
import com.vaadin.ui.Window;
+import com.vaadin.ui.themes.BaseTheme;
@SuppressWarnings("deprecation")
public class VaadinClasses {
@@ -61,6 +62,15 @@ public class VaadinClasses {
}
}
+ public static List<Class<? extends BaseTheme>> getThemeClasses() {
+ try {
+ return findClasses(BaseTheme.class, "com.vaadin.ui.themes");
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
public static List<Class<? extends Object>> getAllServerSideClasses() {
try {
return findClassesNoTests(Object.class, "com.vaadin", new String[] {
diff --git a/tests/server-side/com/vaadin/tests/server/TestThemeNames.java b/tests/server-side/com/vaadin/tests/server/TestThemeNames.java
new file mode 100644
index 0000000000..22fe315730
--- /dev/null
+++ b/tests/server-side/com/vaadin/tests/server/TestThemeNames.java
@@ -0,0 +1,38 @@
+package com.vaadin.tests.server;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import com.vaadin.tests.VaadinClasses;
+import com.vaadin.ui.themes.BaseTheme;
+
+public class TestThemeNames extends TestCase {
+ public void testThemeNames() {
+ File baseDir = new File(SourceFileChecker.getBaseDir()
+ + "WebContent/VAADIN/themes/");
+
+ List<Class<? extends BaseTheme>> themeClasses = VaadinClasses
+ .getThemeClasses();
+ for (Class<? extends BaseTheme> themeClass : themeClasses) {
+ try {
+ Field field = themeClass.getField("THEME_NAME");
+ String themeName = (String) field.get(null);
+
+ File themeDir = new File(baseDir, themeName);
+ File styleFile = new File(themeDir, "styles.css");
+
+ assertTrue("Can't find " + styleFile + " for theme "
+ + themeClass.getName(), styleFile.exists());
+
+ // Test that casing matches
+ assertEquals(themeDir.getCanonicalFile().getName(), themeName);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+}