diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-05-04 09:05:58 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-05-04 09:05:58 +0300 |
commit | e6738e64dc2f7db1733aa568fd2713632b9f8966 (patch) | |
tree | 1353d11c5d37ddfe4b15dd97cf11d50149d9286b /tests/server-side | |
parent | 46c74e7362271ccbcf54c506657d8c0846a61858 (diff) | |
parent | b1ef06fdb8d1dc03dba2afb397aed89089ac5445 (diff) | |
download | vaadin-framework-e6738e64dc2f7db1733aa568fd2713632b9f8966.tar.gz vaadin-framework-e6738e64dc2f7db1733aa568fd2713632b9f8966.zip |
Merge remote branch 'origin/6.8'
Conflicts:
src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
src/com/vaadin/terminal/gwt/client/BrowserInfo.java
src/com/vaadin/terminal/gwt/client/HistoryImplIEVaadin.java
src/com/vaadin/terminal/gwt/client/ui/VButton.java
src/com/vaadin/terminal/gwt/client/ui/VDateFieldCalendar.java
src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java
src/com/vaadin/terminal/gwt/client/ui/VNativeButton.java
src/com/vaadin/terminal/gwt/client/ui/VNotification.java
src/com/vaadin/terminal/gwt/client/ui/VView.java
src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
src/com/vaadin/terminal/gwt/server/RequestTimer.java
src/com/vaadin/ui/Button.java
tests/test.xml
tests/testbench/com/vaadin/tests/components/TouchScrollables.java
Diffstat (limited to 'tests/server-side')
-rw-r--r-- | tests/server-side/com/vaadin/tests/server/SourceFileChecker.java | 42 | ||||
-rw-r--r-- | tests/server-side/com/vaadin/tests/server/component/tree/TestHasChildren.java | 25 |
2 files changed, 67 insertions, 0 deletions
diff --git a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java index 453aab5af8..9906990165 100644 --- a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java +++ b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java @@ -5,6 +5,8 @@ import java.io.FileInputStream; import java.io.IOException; import java.util.HashSet; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import junit.framework.Assert; import junit.framework.TestCase; @@ -81,6 +83,17 @@ public class SourceFileChecker extends TestCase { } } + public void testGwtFilesUsingEntry() { + Set<String> ignore = new HashSet<String>(alwaysIgnore); + ignore.add(externalJavaFiles); + validateFiles( + SRC_DIR, + new GwtEntryChecker(), + ignore, + "The following files might export javscript callbacks without $entry:\n{0}", + ".java"); + } + public interface FileValidator { void validateFile(File f) throws Exception; } @@ -171,4 +184,33 @@ public class SourceFileChecker extends TestCase { } } } + + class GwtEntryChecker extends FileContentsValidator { + // Matches e.g. + // @com.vaadin.terminal.gwt.client.HistoryImplIEVaadin::escapeHtml( + private final Matcher matcher = Pattern.compile("@[\\w.]+::\\w+\\(") + .matcher(""); + + @Override + protected void validateContents(File f, String contents) + throws Exception { + matcher.reset(contents); + while (matcher.find()) { + int start = matcher.start(); + + // Search backwards to find index of native block start + int nativeBlockStart = contents.lastIndexOf("/*-{", start); + + // Get contents between block start and our match + String beforeMatchInBlock = contents.substring( + nativeBlockStart, start); + + // Fail if there's no $entry + if (!beforeMatchInBlock.contains("$entry")) { + throw new IllegalArgumentException(); + } + } + } + + } } diff --git a/tests/server-side/com/vaadin/tests/server/component/tree/TestHasChildren.java b/tests/server-side/com/vaadin/tests/server/component/tree/TestHasChildren.java new file mode 100644 index 0000000000..66535d3ffb --- /dev/null +++ b/tests/server-side/com/vaadin/tests/server/component/tree/TestHasChildren.java @@ -0,0 +1,25 @@ +package com.vaadin.tests.server.component.tree; + +import junit.framework.TestCase; + +import com.vaadin.ui.Tree; + +public class TestHasChildren extends TestCase { + + private Tree tree; + + @Override + protected void setUp() { + tree = new Tree(); + tree.addItem("parent"); + tree.addItem("child"); + tree.setChildrenAllowed("parent", true); + tree.setParent("child", "parent"); + } + + public void testRemoveChildren() { + assertTrue(tree.hasChildren("parent")); + tree.removeItem("child"); + assertFalse(tree.hasChildren("parent")); + } +} |