diff options
author | Patrik Lindström <patrik@vaadin.com> | 2013-11-06 15:19:50 +0200 |
---|---|---|
committer | Patrik Lindström <patrik@vaadin.com> | 2013-11-06 15:27:36 +0200 |
commit | a12b62485dfa9c294e1a483c4b340c2be6a53588 (patch) | |
tree | 037c8e12d1c057ece0c3b3edc22573cbbf324449 | |
parent | 5b8b824942019ab6fc9d70263c22de3644f1f785 (diff) | |
parent | 533ddcda271b7226b38c035adf3073062c562653 (diff) | |
download | vaadin-framework-a12b62485dfa9c294e1a483c4b340c2be6a53588.tar.gz vaadin-framework-a12b62485dfa9c294e1a483c4b340c2be6a53588.zip |
Merge remote-tracking branch 'origin/7.1' into testbench4
Change-Id: If596876f0a17c471dc7db6b6eea25ed1c3b87fb1
69 files changed, 2576 insertions, 1487 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 21f6ce8a31..841e1df96d 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -26,6 +26,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.logging.Logger; import com.google.gwt.aria.client.LiveValue; import com.google.gwt.aria.client.RelevantValue; @@ -63,6 +64,7 @@ import com.google.gwt.user.client.Window.ClosingHandler; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConfiguration.ErrorMessage; +import com.vaadin.client.ApplicationConnection.ApplicationStoppedEvent; import com.vaadin.client.ResourceLoader.ResourceLoadEvent; import com.vaadin.client.ResourceLoader.ResourceLoadListener; import com.vaadin.client.communication.HasJavaScriptConnectorHelper; @@ -295,7 +297,7 @@ public class ApplicationConnection { } @Override - public com.google.gwt.event.shared.GwtEvent.Type<CommunicationHandler> getAssociatedType() { + public Type<CommunicationHandler> getAssociatedType() { return TYPE; } @@ -315,7 +317,7 @@ public class ApplicationConnection { } @Override - public com.google.gwt.event.shared.GwtEvent.Type<CommunicationHandler> getAssociatedType() { + public Type<CommunicationHandler> getAssociatedType() { return TYPE; } @@ -350,7 +352,7 @@ public class ApplicationConnection { public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>(); @Override - public com.google.gwt.event.shared.GwtEvent.Type<CommunicationHandler> getAssociatedType() { + public Type<CommunicationHandler> getAssociatedType() { return TYPE; } @@ -361,6 +363,34 @@ public class ApplicationConnection { } /** + * Event triggered when a application is stopped by calling + * {@link ApplicationConnection#setApplicationRunning(false)}. + * + * To listen for the event add a {@link ApplicationStoppedHandler} by + * invoking + * {@link ApplicationConnection#addHandler(ApplicationStoppedEvent.Type, ApplicationStoppedHandler)} + * to the {@link ApplicationConnection} + * + * @since 7.1.8 + * @author Vaadin Ltd + */ + public static class ApplicationStoppedEvent extends + GwtEvent<ApplicationStoppedHandler> { + + public static Type<ApplicationStoppedHandler> TYPE = new Type<ApplicationStoppedHandler>(); + + @Override + public Type<ApplicationStoppedHandler> getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(ApplicationStoppedHandler listener) { + listener.onApplicationStopped(this); + } + } + + /** * Allows custom handling of communication errors. */ public interface CommunicationErrorHandler { @@ -378,6 +408,27 @@ public class ApplicationConnection { public boolean onError(String details, int statusCode); } + /** + * A listener for listening to application stopped events. The listener can + * be added to a {@link ApplicationConnection} by invoking + * {@link ApplicationConnection#addHandler(ApplicationStoppedEvent.Type, ApplicationStoppedHandler)} + * + * @since 7.1.8 + * @author Vaadin Ltd + */ + public interface ApplicationStoppedHandler extends EventHandler { + + /** + * Triggered when the {@link ApplicationConnection} marks a previously + * running application as stopped by invoking + * {@link ApplicationConnection#setApplicationRunning(false)} + * + * @param event + * the event triggered by the {@link ApplicationConnection} + */ + void onApplicationStopped(ApplicationStoppedEvent event); + } + private CommunicationErrorHandler communicationErrorDelegate = null; private VLoadingIndicator loadingIndicator; @@ -755,6 +806,10 @@ public class ApplicationConnection { showCommunicationError(details, statusCode); } endRequest(); + + // Consider application not running any more and prevent all + // future requests + setApplicationRunning(false); } @Override @@ -886,10 +941,10 @@ public class ApplicationConnection { VConsole.log("JSON parsing took " + (new Date().getTime() - start.getTime()) + "ms"); - if (applicationRunning) { + if (isApplicationRunning()) { handleReceivedJSONMessage(start, jsonText, json); } else { - applicationRunning = true; + setApplicationRunning(true); handleWhenCSSLoaded(jsonText, json); } } @@ -1125,7 +1180,7 @@ public class ApplicationConnection { retryCanceledActiveRequest = false; webkitMaybeIgnoringRequests = false; - if (applicationRunning) { + if (isApplicationRunning()) { checkForPendingVariableBursts(); runPostRequestHooks(configuration.getRootPanelId()); } @@ -1460,7 +1515,7 @@ public class ApplicationConnection { error.getString("message"), error.getString("url")); - applicationRunning = false; + setApplicationRunning(false); } Profiler.leave("Error handling"); } @@ -2383,6 +2438,12 @@ public class ApplicationConnection { */ public void addMethodInvocationToQueue(MethodInvocation invocation, boolean delayed, boolean lastOnly) { + if (!isApplicationRunning()) { + getLogger() + .warning( + "Trying to invoke method on not yet started or stopped application"); + return; + } String tag; if (lastOnly) { tag = invocation.getLastOnlyTag(); @@ -2441,7 +2502,7 @@ public class ApplicationConnection { private boolean deferedSendPending = false; private void doSendPendingVariableChanges() { - if (applicationRunning) { + if (isApplicationRunning()) { if (hasActiveRequest() || (push != null && !push.isActive())) { // skip empty queues if there are pending bursts to be sent if (pendingInvocations.size() > 0 || pendingBursts.size() == 0) { @@ -2453,6 +2514,11 @@ public class ApplicationConnection { } else { buildAndSendVariableBurst(pendingInvocations); } + } else { + getLogger() + .warning( + "Trying to send variable changes from not yet started or stopped application"); + return; } } @@ -3388,6 +3454,9 @@ public class ApplicationConnection { } public void setApplicationRunning(boolean running) { + if (applicationRunning && !running) { + eventBus.fireEvent(new ApplicationStoppedEvent()); + } applicationRunning = running; } @@ -3490,4 +3559,8 @@ public class ApplicationConnection { } } + private static Logger getLogger() { + return Logger.getLogger(ApplicationConnection.class.getName()); + } + } diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index c0e5f621af..274df676aa 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -32,6 +32,7 @@ import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.NodeList; import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style.Display; +import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Touch; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DOM; @@ -448,6 +449,35 @@ public class Util { } /** + * Calculates maximum horizontal scrolling value for the given element. + * + * @since 7.1.9 + * @param element + * which scrollLeft should be calculated + * @return maximum value for scrollLeft of the given element + */ + public static int getMaxScrollLeft(final Element element) { + int scrollWidth = element.getScrollWidth(); + int clientWidth = element.getClientWidth(); + return scrollWidth - clientWidth; + } + + /** + * Checks if scrollLeft of the element is at its maximum value. Returns + * false if the element can't be scrolled horizontally. + * + * @since 7.1.9 + * @param element + * which scrollLeft should be checked + * @return true, if scrollLeft is at maximum (false if element can't be + * scrolled horizontally) + */ + public static boolean isScrollLeftAtMax(final Element element) { + int scrollLeft = element.getScrollLeft(); + return scrollLeft != 0 && scrollLeft == getMaxScrollLeft(element); + } + + /** * Run workaround for webkits overflow auto issue. * * See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462 @@ -468,6 +498,8 @@ public class Util { // check the scrolltop value before hiding the element final int scrolltop = elem.getScrollTop(); final int scrollleft = elem.getScrollLeft(); + final boolean scrollLeftAtMax = isScrollLeftAtMax(elem); + elem.getStyle().setProperty("overflow", "hidden"); Scheduler.get().scheduleDeferred(new Command() { @@ -491,6 +523,12 @@ public class Util { elem.setScrollTop(scrollvalue); } + // keep horizontal scroll at max if it was before vertical + // scroll bar was added/removed + if (scrollLeftAtMax) { + elem.setScrollLeft(getMaxScrollLeft(elem)); + } + // fix for #6940 : Table horizontal scroll sometimes not // updated when collapsing/expanding columns // Also appeared in Safari 5.1 with webkit 534 (#7667) @@ -518,6 +556,56 @@ public class Util { } /** + * Prevents some browsers from adding scroll bars to a component (such as a + * Window) whose contents fit in the component. + * <p> + * See: bugs #11994 and #12736. + * + * @param contentNode + * an element that is scrollable + * + * @since 7.1.8 + */ + public static void removeUnneededScrollbars(final Element scrollable) { + if (BrowserInfo.get().isWebkit()) { + + /* + * Shake up the DOM a bit to make the window shed unnecessary + * scrollbars and resize correctly afterwards. This resulting code + * took over a week to summon forth, and involved some pretty hairy + * black magic. Don't touch it unless you know what you're doing! + * Fixes ticket #11994. Later modified to fix ticket #12736. + */ + Scheduler.get().scheduleFinally(new ScheduledCommand() { + + @Override + public void execute() { + // Adjusting the width or height may change the scroll + // position, so store the current position + int horizontalScrollPosition = scrollable.getScrollLeft(); + int verticalScrollPosition = scrollable.getScrollTop(); + + final String oldWidth = scrollable.getStyle().getWidth(); + final String oldHeight = scrollable.getStyle().getHeight(); + + scrollable.getStyle().setWidth(110, Unit.PCT); + scrollable.getOffsetWidth(); + scrollable.getStyle().setProperty("width", oldWidth); + scrollable.getStyle().setHeight(110, Unit.PCT); + scrollable.getOffsetHeight(); + scrollable.getStyle().setProperty("height", oldHeight); + + // Restore the scroll position + scrollable.setScrollLeft(horizontalScrollPosition); + scrollable.setScrollTop(verticalScrollPosition); + + } + }); + + } + } + + /** * Parses shared state and fetches the relative size of the component. If a * dimension is not specified as relative it will return -1. If the shared * state does not contain width or height specifications this will return diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java index 4bf12ca1f3..320ba9ebe7 100644 --- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java +++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java @@ -350,6 +350,10 @@ public class AtmospherePushConnection implements PushConnection { protected void onReconnect(JavaScriptObject request, final AtmosphereResponse response) { + if (state == State.CONNECTED) { + VConsole.log("No onClose was received before reconnect. Forcing state to closed."); + state = State.CONNECT_PENDING; + } VConsole.log("Reopening push connection"); } diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index 6f98e29d03..8fdaf0a5be 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -15,6 +15,7 @@ */ package com.vaadin.client.ui; +import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.JsArrayString; import com.google.gwt.dom.client.Element; import com.google.gwt.user.client.ui.Focusable; @@ -68,8 +69,16 @@ public abstract class AbstractComponentConnector extends AbstractConnector /** * Creates and returns the widget for this VPaintableWidget. This method * should only be called once when initializing the paintable. + * <p> + * You should typically not override this method since the framework by + * default generates an implementation that uses {@link GWT#create(Class)} + * to create a widget of the same type as returned by the most specific + * override of {@link #getWidget()}. If you do override the method, you + * can't call <code>super.createWidget()</code> since the metadata needed + * for that implementation is not generated if there's an override of the + * method. * - * @return + * @return a new widget instance to use for this component connector */ protected Widget createWidget() { Type type = TypeData.getType(getClass()); @@ -79,10 +88,12 @@ public abstract class AbstractComponentConnector extends AbstractConnector return (Widget) instance; } catch (NoDataException e) { throw new IllegalStateException( - "There is no information about the widget for " + "Default implementation of createWidget() does not work for " + Util.getSimpleName(this) - + ". Did you remember to compile the right widgetset?", - e); + + ". This might be caused by explicitely using " + + "super.createWidget(), using a widget type with " + + "generics or some unspecified problem with the " + + "widgetset compilation.", e); } } diff --git a/client/src/com/vaadin/client/ui/VCalendarPanel.java b/client/src/com/vaadin/client/ui/VCalendarPanel.java index 58e0448b5f..96678fd133 100644 --- a/client/src/com/vaadin/client/ui/VCalendarPanel.java +++ b/client/src/com/vaadin/client/ui/VCalendarPanel.java @@ -56,6 +56,7 @@ import com.vaadin.client.DateTimeService; import com.vaadin.client.Util; import com.vaadin.client.VConsole; import com.vaadin.shared.ui.datefield.Resolution; +import com.vaadin.shared.util.SharedUtil; @SuppressWarnings("deprecation") public class VCalendarPanel extends FocusableFlexTable implements @@ -2214,9 +2215,9 @@ public class VCalendarPanel extends FocusableFlexTable implements * @param startDate * - the allowed range's start date */ - public void setRangeStart(Date rangeStart) { - if (this.rangeStart != rangeStart) { - this.rangeStart = rangeStart; + public void setRangeStart(Date newRangeStart) { + if (!SharedUtil.equals(rangeStart, newRangeStart)) { + rangeStart = newRangeStart; if (initialRenderDone) { // Dynamic updates to the range needs to render the calendar to // update the element stylenames @@ -2233,9 +2234,9 @@ public class VCalendarPanel extends FocusableFlexTable implements * @param endDate * - the allowed range's end date */ - public void setRangeEnd(Date rangeEnd) { - if (this.rangeEnd != rangeEnd) { - this.rangeEnd = rangeEnd; + public void setRangeEnd(Date newRangeEnd) { + if (!SharedUtil.equals(rangeEnd, newRangeEnd)) { + rangeEnd = newRangeEnd; if (initialRenderDone) { // Dynamic updates to the range needs to render the calendar to // update the element stylenames diff --git a/client/src/com/vaadin/client/ui/VPanel.java b/client/src/com/vaadin/client/ui/VPanel.java index 15c3883b11..307a2e4a91 100644 --- a/client/src/com/vaadin/client/ui/VPanel.java +++ b/client/src/com/vaadin/client/ui/VPanel.java @@ -16,18 +16,15 @@ package com.vaadin.client.ui; -import com.google.gwt.core.client.Scheduler; -import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.Document; -import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.SimplePanel; import com.vaadin.client.ApplicationConnection; -import com.vaadin.client.BrowserInfo; import com.vaadin.client.Focusable; +import com.vaadin.client.Util; import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler; @@ -210,43 +207,6 @@ public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner, touchScrollHandler = TouchScrollDelegate.enableTouchScrolling(this); } touchScrollHandler.addElement(contentNode); - - /* - * Shake up the DOM a bit to make the window shed unnecessary scroll - * bars and resize correctly afterwards. This resulting code took over a - * week to summon forth, and involved some pretty hairy black magic. - * Don't touch it unless you know what you're doing! Fixes ticket - * #12727. - * - * This solution comes from the ticket #11994: Windows get unnecessary - * scroll bars in WebKit when content is 100% wide. - */ - if (BrowserInfo.get().isWebkit()) { - Scheduler.get().scheduleFinally(new ScheduledCommand() { - @Override - public void execute() { - final com.google.gwt.dom.client.Element scrollable = contentNode - .getFirstChildElement(); - - int contentNodeScrollTop = contentNode.getScrollTop(); - int contentNodeScrollLeft = contentNode.getScrollLeft(); - - final String oldWidth = scrollable.getStyle().getWidth(); - final String oldHeight = scrollable.getStyle().getHeight(); - - scrollable.getStyle().setWidth(110, Unit.PCT); - scrollable.getOffsetWidth(); - scrollable.getStyle().setProperty("width", oldWidth); - - scrollable.getStyle().setHeight(110, Unit.PCT); - scrollable.getOffsetHeight(); - scrollable.getStyle().setProperty("height", oldHeight); - - // Recovering scroll position: - contentNode.setScrollTop(contentNodeScrollTop); - contentNode.setScrollLeft(contentNodeScrollLeft); - } - }); - } + Util.removeUnneededScrollbars(contentNode); } } diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index ab3a41402d..d9d65387dc 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -278,6 +278,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ private int detachedScrollPosition = 0; + // fields used in fixing erroneously lost scrollLeft + int lastScrollBodyHeight = 0; + boolean lastScrollLeftWasAtMax = false; + /** * Represents a select range of rows */ @@ -1007,6 +1011,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets, initialContentReceived = true; sizeNeedsInit = true; scrollBody.restoreRowVisibility(); + + // At least FireFox requires that scrollLeft is restored deferred after + // scrollBody is recreated + Scheduler.get().scheduleFinally(new ScheduledCommand() { + @Override + public void execute() { + restoreScrollLeft(); + } + }); } /** For internal use only. May be removed or replaced in the future. */ @@ -6881,12 +6894,44 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } /** + * Tries to restore horizontal scroll position if it was lost due to change + * in the height of scrollBody (#12652). + */ + private void restoreScrollLeft() { + int upcomingScrollLeft = scrollLeft; + + if (lastScrollLeftWasAtMax) { + upcomingScrollLeft = Util.getMaxScrollLeft(scrollBodyPanel + .getElement()); + } + scrollBodyPanel.getElement().setScrollLeft(upcomingScrollLeft); + } + + /** + * Checks if restore of scrollLeft is needed by checking if height of the + * scrollBody has changed. + * + * @return true, if restore is required + */ + private boolean isScrollLeftRestoreRequired() { + return (scrollBody.getElement().getClientHeight() != lastScrollBodyHeight); + } + + /** * This method has logic which rows needs to be requested from server when * user scrolls */ - @Override public void onScroll(ScrollEvent event) { + // restore in initializeRows() doesn't work right with Chrome + if (isScrollLeftRestoreRequired()) { + restoreScrollLeft(); + } + + lastScrollBodyHeight = scrollBody.getElement().getClientHeight(); + lastScrollLeftWasAtMax = Util.isScrollLeftAtMax(scrollBodyPanel + .getElement()); + scrollLeft = scrollBodyPanel.getElement().getScrollLeft(); scrollTop = scrollBodyPanel.getScrollPosition(); /* diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index 7dec62bde0..c64216d49f 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -265,7 +265,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, } public boolean updateCaption(UIDL uidl) { - if (uidl.hasAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_DESCRIPTION)) { + if (uidl.hasAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_DESCRIPTION) + || uidl.hasAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_ERROR_MESSAGE)) { setTooltipInfo(new TooltipInfo( uidl.getStringAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_DESCRIPTION), uidl.getStringAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_ERROR_MESSAGE))); diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java index ff6a15e597..62937b6a67 100644 --- a/client/src/com/vaadin/client/ui/VWindow.java +++ b/client/src/com/vaadin/client/ui/VWindow.java @@ -33,6 +33,7 @@ import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.event.dom.client.ScrollEvent; import com.google.gwt.event.dom.client.ScrollHandler; +import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; @@ -47,6 +48,8 @@ import com.vaadin.client.LayoutManager; import com.vaadin.client.Util; import com.vaadin.client.debug.internal.VDebugWindow; import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; +import com.vaadin.client.ui.window.WindowMoveEvent; +import com.vaadin.client.ui.window.WindowMoveHandler; import com.vaadin.shared.EventId; import com.vaadin.shared.ui.window.WindowMode; @@ -342,36 +345,11 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, if (!visibilityChangesDisabled) { super.setVisible(visible); } - if (visible && BrowserInfo.get().isWebkit()) { - - /* - * Shake up the DOM a bit to make the window shed unnecessary - * scrollbars and resize correctly afterwards. This resulting code - * took over a week to summon forth, and involved some pretty hairy - * black magic. Don't touch it unless you know what you're doing! - * Fixes ticket #11994 - */ - Scheduler.get().scheduleFinally(new ScheduledCommand() { - @Override - public void execute() { - final com.google.gwt.dom.client.Element scrollable = contents - .getFirstChildElement(); - final String oldWidth = scrollable.getStyle().getWidth(); - final String oldHeight = scrollable.getStyle().getHeight(); - - scrollable.getStyle().setWidth(110, Unit.PCT); - scrollable.getOffsetWidth(); - scrollable.getStyle().setProperty("width", oldWidth); - - scrollable.getStyle().setHeight(110, Unit.PCT); - scrollable.getOffsetHeight(); - scrollable.getStyle().setProperty("height", oldHeight); - - updateContentsSize(); - positionOrSizeUpdated(); - } - }); + Util.removeUnneededScrollbars((Element) contents + .getFirstChildElement()); + updateContentsSize(); + positionOrSizeUpdated(); } } @@ -946,6 +924,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, dragging = false; hideDraggingCurtain(); DOM.releaseCapture(getElement()); + + // fire move event + fireEvent(new WindowMoveEvent(uidlPositionX, uidlPositionY)); } @Override @@ -1061,4 +1042,14 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, - contentPanel.getElement().getOffsetWidth(); } + /** + * Adds a Handler for when user moves the window. + * + * @since 7.1.9 + * @return {@link HandlerRegistration} used to remove the handler + */ + public HandlerRegistration addMoveHandler(WindowMoveHandler handler) { + return addHandler(handler, WindowMoveEvent.getType()); + } + } diff --git a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java index f018caefa5..d2aadca99b 100644 --- a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java +++ b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java @@ -178,8 +178,16 @@ public class PopupDateFieldConnector extends TextualDateConnector { public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); getWidget().setTextFieldEnabled(getState().textFieldEnabled); - getWidget().setRangeStart(getState().rangeStart); - getWidget().setRangeEnd(getState().rangeEnd); + getWidget().setRangeStart(nullSafeDateClone(getState().rangeStart)); + getWidget().setRangeEnd(nullSafeDateClone(getState().rangeEnd)); + } + + private Date nullSafeDateClone(Date date) { + if (date == null) { + return null; + } else { + return (Date) date.clone(); + } } @Override diff --git a/client/src/com/vaadin/client/ui/table/TableConnector.java b/client/src/com/vaadin/client/ui/table/TableConnector.java index 47229dc9c7..07689a640f 100644 --- a/client/src/com/vaadin/client/ui/table/TableConnector.java +++ b/client/src/com/vaadin/client/ui/table/TableConnector.java @@ -343,6 +343,9 @@ public class TableConnector extends AbstractHasComponentsConnector implements Scheduler.get().scheduleFinally(new ScheduledCommand() { @Override public void execute() { + // IE8 needs some hacks to measure sizes correctly + Util.forceIE8Redraw(getWidget().getElement()); + getLayoutManager().setNeedsMeasure(TableConnector.this); ServerConnector parent = getParent(); if (parent instanceof ComponentConnector) { diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index 46b5f63180..8813d70609 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -45,6 +45,7 @@ import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import com.google.web.bindery.event.shared.HandlerRegistration; import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.ApplicationConnection.ApplicationStoppedEvent; import com.vaadin.client.BrowserInfo; import com.vaadin.client.ComponentConnector; import com.vaadin.client.ConnectorHierarchyChangeEvent; @@ -320,7 +321,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector .getPaintableAttribute("focused", getConnection()); if (paintable == null) { - // Do not try to focus invisible components which not present in UIDL + // Do not try to focus invisible components which not + // present in UIDL return; } @@ -467,6 +469,21 @@ public class UIConnector extends AbstractSingleComponentContainerConnector // side-effects from focusing (scrollIntoView). getWidget().getElement().focus(); } + + applicationConnection.addHandler( + ApplicationConnection.ApplicationStoppedEvent.TYPE, + new ApplicationConnection.ApplicationStoppedHandler() { + + @Override + public void onApplicationStopped( + ApplicationStoppedEvent event) { + // Stop any polling + if (pollTimer != null) { + pollTimer.cancel(); + pollTimer = null; + } + } + }); } private ClickEventHandler clickEventHandler = new ClickEventHandler(this) { @@ -686,6 +703,12 @@ public class UIConnector extends AbstractSingleComponentContainerConnector pollTimer = new Timer() { @Override public void run() { + if (getState().pollInterval < 0) { + // Polling has been cancelled server side + pollTimer.cancel(); + pollTimer = null; + return; + } getRpcProxy(UIServerRpc.class).poll(); // Send changes even though poll is @Delayed getConnection().sendPendingVariableChanges(); diff --git a/client/src/com/vaadin/client/ui/window/WindowConnector.java b/client/src/com/vaadin/client/ui/window/WindowConnector.java index 4b839384a2..54ea384f5a 100644 --- a/client/src/com/vaadin/client/ui/window/WindowConnector.java +++ b/client/src/com/vaadin/client/ui/window/WindowConnector.java @@ -34,6 +34,7 @@ import com.vaadin.client.LayoutManager; import com.vaadin.client.Paintable; import com.vaadin.client.UIDL; import com.vaadin.client.Util; +import com.vaadin.client.communication.RpcProxy; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractSingleComponentContainerConnector; import com.vaadin.client.ui.ClickEventHandler; @@ -52,7 +53,8 @@ import com.vaadin.shared.ui.window.WindowState; @Connect(value = com.vaadin.ui.Window.class) public class WindowConnector extends AbstractSingleComponentContainerConnector implements Paintable, BeforeShortcutActionListener, - SimpleManagedLayout, PostLayoutListener, MayScrollChildren { + SimpleManagedLayout, PostLayoutListener, MayScrollChildren, + WindowMoveHandler { private ClickEventHandler clickEventHandler = new ClickEventHandler(this) { @Override @@ -99,6 +101,8 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector super.init(); VWindow window = getWidget(); + window.id = getConnectorId(); + window.client = getConnection(); getLayoutManager().registerDependency(this, window.contentPanel.getElement()); @@ -110,6 +114,8 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector DoubleClickEvent.getType()); window.setOwner(getConnection().getUIConnector().getWidget()); + + window.addMoveHandler(this); } @Override @@ -127,9 +133,6 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector VWindow window = getWidget(); String connectorId = getConnectorId(); - window.id = getConnectorId(); - window.client = client; - // Workaround needed for Testing Tools (GWT generates window DOM // slightly different in different browsers). window.closeBox.setId(connectorId + "_window_close"); @@ -401,4 +404,11 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector */ return true; } + + @Override + public void onWindowMove(WindowMoveEvent event) { + RpcProxy.create(WindowServerRpc.class, this).windowMoved( + event.getNewX(), event.getNewY()); + + } } diff --git a/client/src/com/vaadin/client/ui/window/WindowMoveEvent.java b/client/src/com/vaadin/client/ui/window/WindowMoveEvent.java new file mode 100644 index 0000000000..439a90e3a1 --- /dev/null +++ b/client/src/com/vaadin/client/ui/window/WindowMoveEvent.java @@ -0,0 +1,82 @@ +/* + * 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.client.ui.window; + +import com.google.gwt.event.shared.GwtEvent; + +/** + * Event for window position updates + * + * @since 7.1.9 + * @author Vaadin Ltd + */ +public class WindowMoveEvent extends GwtEvent<WindowMoveHandler> { + + private static final Type<WindowMoveHandler> TYPE = new Type<WindowMoveHandler>(); + + private final int newX; + private final int newY; + + /** + * Creates a new event with the given parameters + * + * @param x + * The new x-position for the VWindow + * @param y + * The new y-position for the VWindow + */ + public WindowMoveEvent(int x, int y) { + newX = x; + newY = y; + } + + /** + * Gets the new x position of the window + * + * @return the new X position of the VWindow + */ + public int getNewX() { + return newX; + } + + /** + * Gets the new y position of the window + * + * @return the new Y position of the VWindow + */ + public int getNewY() { + return newY; + } + + /** + * Gets the type of the event + * + * @return the type of the event + */ + public static Type<WindowMoveHandler> getType() { + return TYPE; + } + + @Override + public Type<WindowMoveHandler> getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(WindowMoveHandler handler) { + handler.onWindowMove(this); + } +} diff --git a/client/src/com/vaadin/client/ui/window/WindowMoveHandler.java b/client/src/com/vaadin/client/ui/window/WindowMoveHandler.java new file mode 100644 index 0000000000..e30e1853fe --- /dev/null +++ b/client/src/com/vaadin/client/ui/window/WindowMoveHandler.java @@ -0,0 +1,35 @@ +/* + * 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.client.ui.window; + +import com.google.gwt.event.shared.EventHandler; + +/** + * Handler for {@link WindowMoveEvent}s + * + * @since 7.1.9 + * @author Vaadin Ltd + */ +public interface WindowMoveHandler extends EventHandler { + + /** + * Called when the VWindow was moved by the user. + * + * @param event + * Contains new coordinates for the VWindow + */ + public void onWindowMove(WindowMoveEvent event); +} diff --git a/liferay/build.xml b/liferay/build.xml index a13cb37366..fc1d748e55 100644 --- a/liferay/build.xml +++ b/liferay/build.xml @@ -69,4 +69,8 @@ <antcall target="common.clean" /> </target> -</project>
\ No newline at end of file + <target name="checkstyle" /> + + <target name="test" depends="checkstyle" /> + +</project> diff --git a/push/build.xml b/push/build.xml index 9e3c0c1414..abeec2a8b0 100644 --- a/push/build.xml +++ b/push/build.xml @@ -16,9 +16,7 @@ <property name="vaadinPush.debug.js" location="${result.dir}/js/VAADIN/vaadinPush.debug.js" /> <!-- Keep the version number in sync with ivy.xml, server/src/com/vaadin/server/Constants.java --> - <property name="atmosphere.runtime.version" value="1.0.14.vaadin4" /> - <!-- Keep the version number in sync with ivy.xml --> - <property name="atmosphere.js.version" value="2.0.3-vaadin1" /> + <property name="atmosphere.runtime.version" value="1.0.18.vaadin1" /> <property name="jquery.version" value="1.9.0" /> <path id="classpath.compile.custom" /> @@ -32,15 +30,16 @@ <target name="vaadinPush.js"> <mkdir dir="${result.dir}/js/VAADIN" /> - <ivy:resolve file="ivy.xml" conf="push.js" /> + <ivy:resolve log="download-only" file="ivy.xml" conf="push.js" /> <ivy:cachepath pathid="atmosphere.jquery.deps" conf="push.js" /> - <copy todir="${temp.dir}" flatten="true"> + <delete dir="${temp.dir}" /> + <copy flatten="true" tofile="${temp.dir}/jquery.war"> <path refid="atmosphere.jquery.deps" /> </copy> <!-- Unzip to temp dir --> - <unzip src="${temp.dir}/jquery-${atmosphere.js.version}.war" dest="${jquery.unpack}"> + <unzip src="${temp.dir}/jquery.war" dest="${jquery.unpack}"> <patternset> <include name="**/jquery.atmosphere.js" /> <include name="**/jquery-${jquery.version}.js" /> diff --git a/push/ivy.xml b/push/ivy.xml index 1f76224190..2be47512fe 100644 --- a/push/ivy.xml +++ b/push/ivy.xml @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ivy-module [ -<!-- Keep the version numbers in sync with build.xml --> - <!ENTITY atmosphere.runtime.version "1.0.14.vaadin4"> - <!ENTITY atmosphere.js.version "2.0.3-vaadin1"> +<!-- Keep the version number in sync with build.xml --> + <!ENTITY atmosphere.runtime.version "1.0.18.vaadin1"> + + <!ENTITY atmosphere.js.version "2.0.3.vaadin2"> ]> <ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java b/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java index bbd3945a37..cadfdcc774 100644 --- a/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java +++ b/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java @@ -101,6 +101,8 @@ public class DefaultConverterFactory implements ConverterFactory { return new StringToFloatConverter(); } else if (Integer.class.isAssignableFrom(sourceType)) { return new StringToIntegerConverter(); + } else if (Long.class.isAssignableFrom(sourceType)) { + return new StringToLongConverter(); } else if (Boolean.class.isAssignableFrom(sourceType)) { return new StringToBooleanConverter(); } else if (Number.class.isAssignableFrom(sourceType)) { diff --git a/server/src/com/vaadin/data/util/converter/StringToLongConverter.java b/server/src/com/vaadin/data/util/converter/StringToLongConverter.java new file mode 100644 index 0000000000..3532336787 --- /dev/null +++ b/server/src/com/vaadin/data/util/converter/StringToLongConverter.java @@ -0,0 +1,78 @@ +/* + * 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.data.util.converter; + +import java.text.NumberFormat; +import java.util.Locale; + +/** + * A converter that converts from {@link String} to {@link Long} and back. Uses + * the given locale and a {@link NumberFormat} instance for formatting and + * parsing. + * <p> + * Override and overwrite {@link #getFormat(Locale)} to use a different format. + * </p> + * + * @author Vaadin Ltd + * @since 7.2 + */ +public class StringToLongConverter extends + AbstractStringToNumberConverter<Long> { + + /** + * Returns the format used by + * {@link #convertToPresentation(Long, Class, Locale)} and + * {@link #convertToModel(String, Class, Locale)} + * + * @param locale + * The locale to use + * @return A NumberFormat instance + */ + @Override + protected NumberFormat getFormat(Locale locale) { + if (locale == null) { + locale = Locale.getDefault(); + } + return NumberFormat.getIntegerInstance(locale); + } + + /* + * (non-Javadoc) + * + * @see + * com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object, + * java.lang.Class, java.util.Locale) + */ + @Override + public Long convertToModel(String value, Class<? extends Long> targetType, + Locale locale) throws ConversionException { + Number n = convertToNumber(value, targetType, locale); + return n == null ? null : n.longValue(); + + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.data.util.converter.Converter#getModelType() + */ + @Override + public Class<Long> getModelType() { + return Long.class; + } + +} diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java index e910ba903b..b0841da314 100644 --- a/server/src/com/vaadin/server/Constants.java +++ b/server/src/com/vaadin/server/Constants.java @@ -67,7 +67,7 @@ public interface Constants { // Keep the version number in sync with push/build.xml and other locations // listed in that file - static final String REQUIRED_ATMOSPHERE_RUNTIME_VERSION = "1.0.14.vaadin4"; + static final String REQUIRED_ATMOSPHERE_RUNTIME_VERSION = "1.0.18.vaadin1"; static final String INVALID_ATMOSPHERE_VERSION_WARNING = "\n" + "=================================================================\n" diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index c16be33de2..7c0f9599f3 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -427,8 +427,6 @@ public class VaadinServlet extends HttpServlet implements Constants { outWriter.print(output); outWriter.flush(); outWriter.close(); - out.flush(); - } /** diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java index 5820161c1c..c173b401b9 100644 --- a/server/src/com/vaadin/ui/Window.java +++ b/server/src/com/vaadin/ui/Window.java @@ -77,6 +77,16 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, public void windowModeChanged(WindowMode newState) { setWindowMode(newState); } + + @Override + public void windowMoved(int x, int y) { + if (x != getState(false).positionX) { + setPositionX(x); + } + if (y != getState(false).positionY) { + setPositionY(y); + } + } }; /** diff --git a/server/tests/src/com/vaadin/tests/data/converter/TestStringToLongConverter.java b/server/tests/src/com/vaadin/tests/data/converter/TestStringToLongConverter.java new file mode 100644 index 0000000000..18e2ed06c0 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/data/converter/TestStringToLongConverter.java @@ -0,0 +1,68 @@ +package com.vaadin.tests.data.converter; + +import java.util.Locale; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import com.vaadin.data.util.converter.Converter; +import com.vaadin.data.util.converter.ReverseConverter; +import com.vaadin.data.util.converter.StringToLongConverter; + +public class TestStringToLongConverter extends TestCase { + + StringToLongConverter converter = new StringToLongConverter(); + Converter<Long, String> reverseConverter = new ReverseConverter<Long, String>( + converter); + + public void testNullConversion() { + assertEquals(null, converter.convertToModel(null, Long.class, null)); + } + + public void testReverseNullConversion() { + assertEquals(null, + reverseConverter.convertToModel(null, String.class, null)); + } + + public void testEmptyStringConversion() { + assertEquals(null, converter.convertToModel("", Long.class, null)); + } + + public void testValueConversion() { + assertEquals(Long.valueOf(10), + converter.convertToModel("10", Long.class, null)); + } + + public void testReverseValueConversion() { + assertEquals(reverseConverter.convertToModel(10L, String.class, null), + "10"); + } + + public void testExtremeLongValueConversion() { + long l = converter.convertToModel("9223372036854775807", Long.class, + null); + Assert.assertEquals(Long.MAX_VALUE, l); + l = converter.convertToModel("-9223372036854775808", Long.class, null); + assertEquals(Long.MIN_VALUE, l); + } + + public void testExtremeReverseLongValueConversion() { + String str = reverseConverter.convertToModel(Long.MAX_VALUE, + String.class, Locale.ENGLISH); + Assert.assertEquals("9,223,372,036,854,775,807", str); + str = reverseConverter.convertToModel(Long.MIN_VALUE, String.class, + null); + Assert.assertEquals("-9,223,372,036,854,775,808", str); + } + + public void testOutOfBoundsValueConversion() { + // Long.MAX_VALUE+1 is converted to Long.MAX_VALUE + long l = converter.convertToModel("9223372036854775808", Long.class, + null); + Assert.assertEquals(Long.MAX_VALUE, l); + // Long.MIN_VALUE-1 is converted to Long.MIN_VALUE + l = converter.convertToModel("-9223372036854775809", Long.class, null); + assertEquals(Long.MIN_VALUE, l); + + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java index bac024725f..99397e9e8f 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java @@ -43,6 +43,33 @@ public class DefaultConverterFactory extends TestCase { } + public static class LongBean { + long l1; + Long l2; + + public LongBean(long l1, Long l2) { + this.l1 = l1; + this.l2 = l2; + } + + public long getL1() { + return l1; + } + + public void setL1(long l1) { + this.l1 = l1; + } + + public Long getL2() { + return l2; + } + + public void setL2(Long l2) { + this.l2 = l2; + } + + } + Person paulaBean = new Person("Paula", "Brilliant", "paula@brilliant.com", 34, Sex.FEMALE, new Address("Paula street 1", 12345, "P-town", Country.FINLAND)); @@ -68,6 +95,21 @@ public class DefaultConverterFactory extends TestCase { assertEquals(24f, tf.getPropertyDataSource().getValue()); } + public void testLongConversion() { + VaadinSession sess = new AlwaysLockedVaadinSession(null); + VaadinSession.setCurrent(sess); + + TextField tf = new TextField(); + tf.setLocale(new Locale("en", "US")); + tf.setPropertyDataSource(new MethodProperty<Integer>(new LongBean(12, + 1982739187238L), "l2")); + assertEquals("1,982,739,187,238", tf.getValue()); + tf.setValue("1982739187239"); + assertEquals("1,982,739,187,239", tf.getValue()); + assertEquals(1982739187239L, tf.getConvertedValue()); + assertEquals(1982739187239L, tf.getPropertyDataSource().getValue()); + } + public void testDefaultNumberConversion() { VaadinSession app = new AlwaysLockedVaadinSession(null); VaadinSession.setCurrent(app); diff --git a/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java b/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java index b43765274e..1307b1e765 100644 --- a/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java +++ b/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java @@ -22,4 +22,6 @@ public interface WindowServerRpc extends ClickRpc, ServerRpc { public void windowModeChanged(WindowMode newState); + public void windowMoved(int x, int y); + }
\ No newline at end of file diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java index d7662d35a8..bdc5fbc86f 100755 --- a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java +++ b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java @@ -159,6 +159,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { /** * This method parses only one rule (style rule or at-rule, except + * * @charset). * * @param source @@ -972,6 +973,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { case HASH: case MEDIA_SYM: case KEY_FRAME_SYM: + case ATKEYWORD: ; break; default: @@ -1000,6 +1002,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { case HASH: case MEDIA_SYM: case KEY_FRAME_SYM: + case ATKEYWORD: ifContentStatement(); break; case MICROSOFT_RULE: @@ -1917,6 +1920,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { case IMPORT_SYM: case MEDIA_SYM: case KEY_FRAME_SYM: + case ATKEYWORD: ; break; default: @@ -1945,6 +1949,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { case HASH: case MEDIA_SYM: case KEY_FRAME_SYM: + case ATKEYWORD: ifContentStatement(); break; case MICROSOFT_RULE: @@ -2863,6 +2868,9 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { case IF_SYM: controlDirective(); break; + case ATKEYWORD: + atRuleDeclaration(); + break; default: jj_la1[107] = jj_gen; jj_consume_token(-1); @@ -2942,14 +2950,48 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { case VARIABLE: case HASH: case MEDIA_SYM: + case FONT_FACE_SYM: case KEY_FRAME_SYM: + case ATKEYWORD: ; break; default: jj_la1[110] = jj_gen; break label_71; } - ifContentStatement(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PLUS: + case PRECEDES: + case SIBLING: + case LBRACKET: + case ANY: + case PARENT: + case DOT: + case COLON: + case INTERPOLATION: + case INCLUDE_SYM: + case DEBUG_SYM: + case WARN_SYM: + case EACH_SYM: + case IF_SYM: + case EXTEND_SYM: + case CONTENT_SYM: + case IDENT: + case VARIABLE: + case HASH: + case MEDIA_SYM: + case KEY_FRAME_SYM: + case ATKEYWORD: + ifContentStatement(); + break; + case FONT_FACE_SYM: + fontFace(); + break; + default: + jj_la1[111] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } } jj_consume_token(RBRACE); label_72: while (true) { @@ -2958,7 +3000,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[111] = jj_gen; + jj_la1[112] = jj_gen; break label_72; } jj_consume_token(S); @@ -2969,7 +3011,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[112] = jj_gen; + jj_la1[113] = jj_gen; break label_73; } elseDirective(); @@ -2988,7 +3030,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[113] = jj_gen; + jj_la1[114] = jj_gen; break label_74; } jj_consume_token(S); @@ -3021,13 +3063,13 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[114] = jj_gen; + jj_la1[115] = jj_gen; break label_75; } } break; default: - jj_la1[115] = jj_gen; + jj_la1[116] = jj_gen; ; } jj_consume_token(LBRACE); @@ -3037,7 +3079,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[116] = jj_gen; + jj_la1[117] = jj_gen; break label_76; } jj_consume_token(S); @@ -3069,14 +3111,48 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { case VARIABLE: case HASH: case MEDIA_SYM: + case FONT_FACE_SYM: case KEY_FRAME_SYM: + case ATKEYWORD: ; break; default: - jj_la1[117] = jj_gen; + jj_la1[118] = jj_gen; break label_77; } - ifContentStatement(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PLUS: + case PRECEDES: + case SIBLING: + case LBRACKET: + case ANY: + case PARENT: + case DOT: + case COLON: + case INTERPOLATION: + case INCLUDE_SYM: + case DEBUG_SYM: + case WARN_SYM: + case EACH_SYM: + case IF_SYM: + case EXTEND_SYM: + case CONTENT_SYM: + case IDENT: + case VARIABLE: + case HASH: + case MEDIA_SYM: + case KEY_FRAME_SYM: + case ATKEYWORD: + ifContentStatement(); + break; + case FONT_FACE_SYM: + fontFace(); + break; + default: + jj_la1[119] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } } jj_consume_token(RBRACE); label_78: while (true) { @@ -3085,7 +3161,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[118] = jj_gen; + jj_la1[120] = jj_gen; break label_78; } jj_consume_token(S); @@ -3151,7 +3227,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { n = jj_consume_token(NOT_EQ); break; default: - jj_la1[119] = jj_gen; + jj_la1[121] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3183,7 +3259,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[120] = jj_gen; + jj_la1[122] = jj_gen; break label_79; } jj_consume_token(S); @@ -3195,7 +3271,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[121] = jj_gen; + jj_la1[123] = jj_gen; break label_80; } jj_consume_token(S); @@ -3207,7 +3283,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[122] = jj_gen; + jj_la1[124] = jj_gen; break label_81; } jj_consume_token(S); @@ -3222,7 +3298,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { documentHandler.startEachDirective(var.image, listVariable); break; default: - jj_la1[123] = jj_gen; + jj_la1[125] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3233,7 +3309,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[124] = jj_gen; + jj_la1[126] = jj_gen; break label_82; } jj_consume_token(S); @@ -3261,10 +3337,11 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { case HASH: case MEDIA_SYM: case KEY_FRAME_SYM: + case ATKEYWORD: ; break; default: - jj_la1[125] = jj_gen; + jj_la1[127] = jj_gen; break label_83; } ifContentStatement(); @@ -3276,7 +3353,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[126] = jj_gen; + jj_la1[128] = jj_gen; break label_84; } jj_consume_token(S); @@ -3294,7 +3371,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[127] = jj_gen; + jj_la1[129] = jj_gen; break label_85; } jj_consume_token(S); @@ -3306,7 +3383,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[128] = jj_gen; + jj_la1[130] = jj_gen; break label_86; } jj_consume_token(COMMA); @@ -3316,7 +3393,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[129] = jj_gen; + jj_la1[131] = jj_gen; break label_87; } jj_consume_token(S); @@ -3329,7 +3406,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[130] = jj_gen; + jj_la1[132] = jj_gen; break label_88; } jj_consume_token(S); @@ -3354,7 +3431,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[131] = jj_gen; + jj_la1[133] = jj_gen; break label_89; } jj_consume_token(S); @@ -3374,14 +3451,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[132] = jj_gen; + jj_la1[134] = jj_gen; break label_90; } jj_consume_token(S); } break; default: - jj_la1[133] = jj_gen; + jj_la1[135] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3392,7 +3469,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[134] = jj_gen; + jj_la1[136] = jj_gen; break label_91; } jj_consume_token(S); @@ -3421,12 +3498,12 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { case HASH: case MEDIA_SYM: case PAGE_SYM: - case FONT_FACE_SYM: case KEY_FRAME_SYM: + case ATKEYWORD: ; break; default: - jj_la1[135] = jj_gen; + jj_la1[137] = jj_gen; break label_92; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { @@ -3451,16 +3528,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { case HASH: case MEDIA_SYM: case KEY_FRAME_SYM: + case ATKEYWORD: ifContentStatement(); break; - case FONT_FACE_SYM: - fontFace(); - break; case PAGE_SYM: page(); break; default: - jj_la1[136] = jj_gen; + jj_la1[138] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3472,7 +3547,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[137] = jj_gen; + jj_la1[139] = jj_gen; break label_93; } jj_consume_token(S); @@ -3491,7 +3566,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[138] = jj_gen; + jj_la1[140] = jj_gen; break label_94; } jj_consume_token(COMMA); @@ -3501,7 +3576,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[139] = jj_gen; + jj_la1[141] = jj_gen; break label_95; } jj_consume_token(S); @@ -3559,7 +3634,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[140] = jj_gen; + jj_la1[142] = jj_gen; break label_96; } jj_consume_token(S); @@ -3581,14 +3656,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[141] = jj_gen; + jj_la1[143] = jj_gen; break label_98; } jj_consume_token(S); } break; default: - jj_la1[142] = jj_gen; + jj_la1[144] = jj_gen; ; } prev = nonVariableTerm(prev); @@ -3600,13 +3675,13 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { token.beginColumn, prev, variable.image); break; default: - jj_la1[143] = jj_gen; + jj_la1[145] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[144] = jj_gen; + jj_la1[146] = jj_gen; ; } VariableNode arg = new VariableNode(name, first, false); @@ -3666,7 +3741,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[145] = jj_gen; + jj_la1[147] = jj_gen; break label_99; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { @@ -3678,14 +3753,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[146] = jj_gen; + jj_la1[148] = jj_gen; break label_100; } jj_consume_token(S); } break; default: - jj_la1[147] = jj_gen; + jj_la1[149] = jj_gen; ; } next = term(prev); @@ -3698,7 +3773,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[148] = jj_gen; + jj_la1[150] = jj_gen; break label_101; } jj_consume_token(COMMA); @@ -3708,7 +3783,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[149] = jj_gen; + jj_la1[151] = jj_gen; break label_102; } jj_consume_token(S); @@ -3755,7 +3830,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[150] = jj_gen; + jj_la1[152] = jj_gen; break label_103; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { @@ -3767,14 +3842,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[151] = jj_gen; + jj_la1[153] = jj_gen; break label_104; } jj_consume_token(S); } break; default: - jj_la1[152] = jj_gen; + jj_la1[154] = jj_gen; ; } next = term(prev); @@ -3800,7 +3875,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[153] = jj_gen; + jj_la1[155] = jj_gen; break label_105; } jj_consume_token(S); @@ -3820,7 +3895,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { jj_consume_token(RPARAN); break; default: - jj_la1[154] = jj_gen; + jj_la1[156] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3830,7 +3905,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[155] = jj_gen; + jj_la1[157] = jj_gen; break label_106; } jj_consume_token(S); @@ -3845,7 +3920,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[156] = jj_gen; + jj_la1[158] = jj_gen; break label_108; } jj_consume_token(S); @@ -3855,7 +3930,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[157] = jj_gen; + jj_la1[159] = jj_gen; break label_107; } } @@ -3869,7 +3944,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[158] = jj_gen; + jj_la1[160] = jj_gen; break label_109; } jj_consume_token(S); @@ -3893,7 +3968,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[159] = jj_gen; + jj_la1[161] = jj_gen; break label_110; } styleRuleOrDeclarationOrNestedProperties(); @@ -3905,7 +3980,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[160] = jj_gen; + jj_la1[162] = jj_gen; break label_111; } jj_consume_token(S); @@ -3913,7 +3988,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { documentHandler.endIncludeContentBlock(); break; default: - jj_la1[161] = jj_gen; + jj_la1[163] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3946,7 +4021,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[162] = jj_gen; + jj_la1[164] = jj_gen; break label_112; } jj_consume_token(S); @@ -3958,7 +4033,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[163] = jj_gen; + jj_la1[165] = jj_gen; break label_113; } jj_consume_token(S); @@ -3974,7 +4049,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { type = jj_consume_token(CONTAINS); break; default: - jj_la1[164] = jj_gen; + jj_la1[166] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3984,7 +4059,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[165] = jj_gen; + jj_la1[167] = jj_gen; break label_114; } jj_consume_token(S); @@ -3995,7 +4070,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { jj_consume_token(RPARAN); break; default: - jj_la1[166] = jj_gen; + jj_la1[168] = jj_gen; ; } jj_consume_token(COMMA); @@ -4005,7 +4080,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[167] = jj_gen; + jj_la1[169] = jj_gen; break label_115; } jj_consume_token(S); @@ -4020,7 +4095,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[168] = jj_gen; + jj_la1[170] = jj_gen; break label_116; } jj_consume_token(S); @@ -4033,14 +4108,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[169] = jj_gen; + jj_la1[171] = jj_gen; break label_117; } jj_consume_token(S); } break; default: - jj_la1[170] = jj_gen; + jj_la1[172] = jj_gen; ; } jj_consume_token(RPARAN); @@ -4067,7 +4142,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[171] = jj_gen; + jj_la1[173] = jj_gen; break label_118; } jj_consume_token(S); @@ -4079,7 +4154,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[172] = jj_gen; + jj_la1[174] = jj_gen; break label_119; } jj_consume_token(S); @@ -4104,7 +4179,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[173] = jj_gen; + jj_la1[175] = jj_gen; break label_120; } jj_consume_token(S); @@ -4116,7 +4191,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[174] = jj_gen; + jj_la1[176] = jj_gen; break label_121; } jj_consume_token(S); @@ -4128,7 +4203,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[175] = jj_gen; + jj_la1[177] = jj_gen; break label_122; } jj_consume_token(S); @@ -4139,7 +4214,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { jj_consume_token(RPARAN); break; default: - jj_la1[176] = jj_gen; + jj_la1[178] = jj_gen; ; } jj_consume_token(COMMA); @@ -4149,7 +4224,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[177] = jj_gen; + jj_la1[179] = jj_gen; break label_123; } jj_consume_token(S); @@ -4164,7 +4239,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[178] = jj_gen; + jj_la1[180] = jj_gen; break label_124; } jj_consume_token(S); @@ -4177,14 +4252,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[179] = jj_gen; + jj_la1[181] = jj_gen; break label_125; } jj_consume_token(S); } break; default: - jj_la1[180] = jj_gen; + jj_la1[182] = jj_gen; ; } jj_consume_token(RPARAN); @@ -4209,7 +4284,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[181] = jj_gen; + jj_la1[183] = jj_gen; break label_126; } jj_consume_token(S); @@ -4221,7 +4296,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[182] = jj_gen; + jj_la1[184] = jj_gen; break label_127; } jj_consume_token(S); @@ -4233,7 +4308,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[183] = jj_gen; + jj_la1[185] = jj_gen; break label_128; } jj_consume_token(S); @@ -4244,7 +4319,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { jj_consume_token(RPARAN); break; default: - jj_la1[184] = jj_gen; + jj_la1[186] = jj_gen; ; } jj_consume_token(COMMA); @@ -4254,7 +4329,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[185] = jj_gen; + jj_la1[187] = jj_gen; break label_129; } jj_consume_token(S); @@ -4269,7 +4344,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[186] = jj_gen; + jj_la1[188] = jj_gen; break label_130; } jj_consume_token(S); @@ -4282,14 +4357,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[187] = jj_gen; + jj_la1[189] = jj_gen; break label_131; } jj_consume_token(S); } break; default: - jj_la1[188] = jj_gen; + jj_la1[190] = jj_gen; ; } jj_consume_token(RPARAN); @@ -4316,7 +4391,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[189] = jj_gen; + jj_la1[191] = jj_gen; break label_132; } jj_consume_token(S); @@ -4328,14 +4403,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[190] = jj_gen; + jj_la1[192] = jj_gen; break label_133; } jj_consume_token(S); } break; default: - jj_la1[191] = jj_gen; + jj_la1[193] = jj_gen; ; } jj_consume_token(CONTAINS); @@ -4345,7 +4420,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[192] = jj_gen; + jj_la1[194] = jj_gen; break label_134; } jj_consume_token(S); @@ -4356,7 +4431,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { jj_consume_token(RPARAN); break; default: - jj_la1[193] = jj_gen; + jj_la1[195] = jj_gen; ; } jj_consume_token(COMMA); @@ -4366,7 +4441,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[194] = jj_gen; + jj_la1[196] = jj_gen; break label_135; } jj_consume_token(S); @@ -4381,7 +4456,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[195] = jj_gen; + jj_la1[197] = jj_gen; break label_136; } jj_consume_token(S); @@ -4394,14 +4469,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[196] = jj_gen; + jj_la1[198] = jj_gen; break label_137; } jj_consume_token(S); } break; default: - jj_la1[197] = jj_gen; + jj_la1[199] = jj_gen; ; } jj_consume_token(RPARAN); @@ -4503,7 +4578,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { warnDirective(); break; default: - jj_la1[198] = jj_gen; + jj_la1[200] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4521,7 +4596,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[199] = jj_gen; + jj_la1[201] = jj_gen; break label_138; } jj_consume_token(S); @@ -4540,7 +4615,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[200] = jj_gen; + jj_la1[202] = jj_gen; break label_139; } jj_consume_token(S); @@ -4567,7 +4642,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { exclusive = false; break; default: - jj_la1[201] = jj_gen; + jj_la1[203] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4578,7 +4653,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[202] = jj_gen; + jj_la1[204] = jj_gen; break label_140; } jj_consume_token(S); @@ -4615,7 +4690,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[203] = jj_gen; + jj_la1[205] = jj_gen; break label_141; } jj_consume_token(S); @@ -4629,7 +4704,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[204] = jj_gen; + jj_la1[206] = jj_gen; break label_143; } jj_consume_token(S); @@ -4639,7 +4714,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[205] = jj_gen; + jj_la1[207] = jj_gen; break label_142; } } @@ -4654,7 +4729,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[206] = jj_gen; + jj_la1[208] = jj_gen; break label_144; } jj_consume_token(S); @@ -4667,7 +4742,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[207] = jj_gen; + jj_la1[209] = jj_gen; break label_146; } jj_consume_token(S); @@ -4677,7 +4752,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[208] = jj_gen; + jj_la1[210] = jj_gen; break label_145; } } @@ -4711,7 +4786,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[209] = jj_gen; + jj_la1[211] = jj_gen; break label_147; } jj_consume_token(S); @@ -4723,7 +4798,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[210] = jj_gen; + jj_la1[212] = jj_gen; break label_148; } jj_consume_token(S); @@ -4735,7 +4810,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { declaration(); break; default: - jj_la1[211] = jj_gen; + jj_la1[213] = jj_gen; ; } label_149: while (true) { @@ -4744,7 +4819,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[212] = jj_gen; + jj_la1[214] = jj_gen; break label_149; } jj_consume_token(SEMICOLON); @@ -4754,7 +4829,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[213] = jj_gen; + jj_la1[215] = jj_gen; break label_150; } jj_consume_token(S); @@ -4765,7 +4840,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { declaration(); break; default: - jj_la1[214] = jj_gen; + jj_la1[216] = jj_gen; ; } } @@ -4777,7 +4852,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[215] = jj_gen; + jj_la1[217] = jj_gen; break label_151; } jj_consume_token(S); @@ -4797,7 +4872,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { debuggingDirective(); break; default: - jj_la1[216] = jj_gen; + jj_la1[218] = jj_gen; if (jj_2_6(2147483647)) { styleRule(); } else if (jj_2_7(3)) { @@ -4818,7 +4893,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { styleRule(); break; default: - jj_la1[217] = jj_gen; + jj_la1[219] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -4869,7 +4944,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[218] = jj_gen; + jj_la1[220] = jj_gen; break label_152; } jj_consume_token(S); @@ -4914,7 +4989,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { important = prio(); break; default: - jj_la1[219] = jj_gen; + jj_la1[221] = jj_gen; ; } Token next = getToken(1); @@ -4942,7 +5017,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[220] = jj_gen; + jj_la1[222] = jj_gen; break label_153; } jj_consume_token(S); @@ -4954,7 +5029,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { declaration(); break; default: - jj_la1[221] = jj_gen; + jj_la1[223] = jj_gen; ; } label_154: while (true) { @@ -4963,7 +5038,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[222] = jj_gen; + jj_la1[224] = jj_gen; break label_154; } jj_consume_token(SEMICOLON); @@ -4973,7 +5048,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[223] = jj_gen; + jj_la1[225] = jj_gen; break label_155; } jj_consume_token(S); @@ -4984,7 +5059,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { declaration(); break; default: - jj_la1[224] = jj_gen; + jj_la1[226] = jj_gen; ; } } @@ -4995,7 +5070,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[225] = jj_gen; + jj_la1[227] = jj_gen; break label_156; } jj_consume_token(S); @@ -5003,7 +5078,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { documentHandler.endNestedProperties(name); break; default: - jj_la1[226] = jj_gen; + jj_la1[228] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5057,7 +5132,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[227] = jj_gen; + jj_la1[229] = jj_gen; break label_157; } jj_consume_token(S); @@ -5068,7 +5143,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { important = prio(); break; default: - jj_la1[228] = jj_gen; + jj_la1[230] = jj_gen; ; } documentHandler.property(name, exp, important); @@ -5115,7 +5190,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[229] = jj_gen; + jj_la1[231] = jj_gen; break label_158; } jj_consume_token(S); @@ -5136,7 +5211,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[230] = jj_gen; + jj_la1[232] = jj_gen; break label_159; } jj_consume_token(S); @@ -5175,7 +5250,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[231] = jj_gen; + jj_la1[233] = jj_gen; break label_160; } jj_consume_token(S); @@ -5195,7 +5270,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[232] = jj_gen; + jj_la1[234] = jj_gen; break label_161; } jj_consume_token(S); @@ -5215,7 +5290,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[233] = jj_gen; + jj_la1[235] = jj_gen; break label_162; } jj_consume_token(S); @@ -5235,7 +5310,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[234] = jj_gen; + jj_la1[236] = jj_gen; break label_163; } jj_consume_token(S); @@ -5256,7 +5331,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[235] = jj_gen; + jj_la1[237] = jj_gen; break label_164; } } @@ -5276,7 +5351,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[236] = jj_gen; + jj_la1[238] = jj_gen; break label_165; } } @@ -5288,7 +5363,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { } break; default: - jj_la1[237] = jj_gen; + jj_la1[239] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5348,7 +5423,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { } break; default: - jj_la1[238] = jj_gen; + jj_la1[240] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5403,7 +5478,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { result = variableTerm(prev); break; default: - jj_la1[239] = jj_gen; + jj_la1[241] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5467,7 +5542,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { op = unaryOperator(); break; default: - jj_la1[240] = jj_gen; + jj_la1[242] = jj_gen; ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { @@ -5574,15 +5649,20 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { && (Character.isDigit(s.charAt(i)) || (s.charAt(i) == '.'))) { i++; } + /* + * result = LexicalUnitImpl.createDimen(n.beginLine, + * n.beginColumn, prev, Float.valueOf(s.substring(0, + * i)).floatValue(), s.substring(i)); + */ result = LexicalUnitImpl.createDimen(n.beginLine, - n.beginColumn, prev, Float.valueOf(s.substring(0, i)) - .floatValue(), s.substring(i)); + n.beginColumn, prev, number(op, n, s.length() - i), + s.substring(i)); break; case FUNCTION: result = function(op, prev); break; default: - jj_la1[241] = jj_gen; + jj_la1[243] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5614,7 +5694,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { s += "."; break; default: - jj_la1[242] = jj_gen; + jj_la1[244] = jj_gen; ; } switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { @@ -5631,7 +5711,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { n = jj_consume_token(FROM); break; default: - jj_la1[243] = jj_gen; + jj_la1[245] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5669,13 +5749,13 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { result = unicode(prev); break; default: - jj_la1[244] = jj_gen; + jj_la1[246] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[245] = jj_gen; + jj_la1[247] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -5685,7 +5765,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[246] = jj_gen; + jj_la1[248] = jj_gen; break label_167; } jj_consume_token(S); @@ -5715,7 +5795,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[247] = jj_gen; + jj_la1[249] = jj_gen; break label_168; } jj_consume_token(S); @@ -5775,7 +5855,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { params = expr(); break; default: - jj_la1[248] = jj_gen; + jj_la1[250] = jj_gen; ; } jj_consume_token(RPARAN); @@ -6324,7 +6404,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[249] = jj_gen; + jj_la1[251] = jj_gen; break label_169; } jj_consume_token(S); @@ -6360,7 +6440,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { fontFace(); break; default: - jj_la1[250] = jj_gen; + jj_la1[252] = jj_gen; ret = skipStatement(); if ((ret == null) || (ret.length() == 0)) { { @@ -6389,7 +6469,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[251] = jj_gen; + jj_la1[253] = jj_gen; break label_170; } jj_consume_token(S); @@ -6404,7 +6484,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[252] = jj_gen; + jj_la1[254] = jj_gen; break label_171; } jj_consume_token(S); @@ -6419,7 +6499,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[253] = jj_gen; + jj_la1[255] = jj_gen; break label_172; } jj_consume_token(S); @@ -6430,7 +6510,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { declaration(); break; default: - jj_la1[254] = jj_gen; + jj_la1[256] = jj_gen; ; } label_173: while (true) { @@ -6439,7 +6519,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[255] = jj_gen; + jj_la1[257] = jj_gen; break label_173; } jj_consume_token(SEMICOLON); @@ -6449,7 +6529,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[256] = jj_gen; + jj_la1[258] = jj_gen; break label_174; } jj_consume_token(S); @@ -6460,7 +6540,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { declaration(); break; default: - jj_la1[257] = jj_gen; + jj_la1[259] = jj_gen; ; } } @@ -6475,7 +6555,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { ; break; default: - jj_la1[258] = jj_gen; + jj_la1[260] = jj_gen; break label_175; } jj_consume_token(S); @@ -7110,15 +7190,15 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { return false; } - private boolean jj_3R_299() { - if (jj_scan_token(INTERPOLATION)) { + private boolean jj_3R_266() { + if (jj_3R_187()) { return true; } return false; } - private boolean jj_3R_266() { - if (jj_3R_187()) { + private boolean jj_3R_299() { + if (jj_scan_token(INTERPOLATION)) { return true; } return false; @@ -7138,6 +7218,28 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { return false; } + private boolean jj_3R_256() { + if (jj_scan_token(FUNCTION)) { + return true; + } + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_scan_token(1)) { + jj_scanpos = xsp; + break; + } + } + xsp = jj_scanpos; + if (jj_3R_266()) { + jj_scanpos = xsp; + } + if (jj_scan_token(RPARAN)) { + return true; + } + return false; + } + private boolean jj_3R_263() { Token xsp; xsp = jj_scanpos; @@ -7187,8 +7289,8 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { return false; } - private boolean jj_3R_256() { - if (jj_scan_token(FUNCTION)) { + private boolean jj_3R_180() { + if (jj_scan_token(COMMA)) { return true; } Token xsp; @@ -7199,47 +7301,32 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { break; } } - xsp = jj_scanpos; - if (jj_3R_266()) { - jj_scanpos = xsp; - } - if (jj_scan_token(RPARAN)) { - return true; - } return false; } - private boolean jj_3R_180() { - if (jj_scan_token(COMMA)) { + private boolean jj_3R_247() { + if (jj_3R_260()) { return true; } - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_scan_token(1)) { - jj_scanpos = xsp; - break; - } - } return false; } - private boolean jj_3R_247() { - if (jj_3R_260()) { + private boolean jj_3R_246() { + if (jj_3R_259()) { return true; } return false; } - private boolean jj_3R_298() { - if (jj_scan_token(IDENT)) { + private boolean jj_3R_245() { + if (jj_3R_258()) { return true; } return false; } - private boolean jj_3R_246() { - if (jj_3R_259()) { + private boolean jj_3R_298() { + if (jj_scan_token(IDENT)) { return true; } return false; @@ -7257,13 +7344,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { return false; } - private boolean jj_3R_245() { - if (jj_3R_258()) { - return true; - } - return false; - } - private boolean jj_3R_297() { if (jj_3R_219()) { return true; @@ -7525,21 +7605,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { return false; } - private boolean jj_3R_196() { - if (jj_3R_220()) { - return true; - } - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_273()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - private boolean jj_3R_199() { Token xsp; xsp = jj_scanpos; @@ -7561,6 +7626,21 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { return false; } + private boolean jj_3R_196() { + if (jj_3R_220()) { + return true; + } + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_273()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + private boolean jj_3R_195() { if (jj_3R_219()) { return true; @@ -7899,6 +7979,13 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { return false; } + private boolean jj_3R_258() { + if (jj_scan_token(HASH)) { + return true; + } + return false; + } + private boolean jj_3_1() { if (jj_3R_176()) { return true; @@ -8013,13 +8100,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { return false; } - private boolean jj_3R_258() { - if (jj_scan_token(HASH)) { - return true; - } - return false; - } - private boolean jj_3_4() { if (jj_3R_179()) { return true; @@ -8027,15 +8107,15 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { return false; } - private boolean jj_3R_251() { - if (jj_3R_186()) { + private boolean jj_3R_259() { + if (jj_scan_token(URL)) { return true; } return false; } - private boolean jj_3R_259() { - if (jj_scan_token(URL)) { + private boolean jj_3R_251() { + if (jj_3R_186()) { return true; } return false; @@ -8088,6 +8168,13 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { return false; } + private boolean jj_3R_260() { + if (jj_scan_token(UNICODERANGE)) { + return true; + } + return false; + } + private boolean jj_3R_255() { Token xsp; xsp = jj_scanpos; @@ -8107,13 +8194,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { return false; } - private boolean jj_3R_260() { - if (jj_scan_token(UNICODERANGE)) { - return true; - } - return false; - } - private boolean jj_3_8() { Token xsp; xsp = jj_scanpos; @@ -8258,7 +8338,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { private Token jj_scanpos, jj_lastpos; private int jj_la; private int jj_gen; - final private int[] jj_la1 = new int[259]; + final private int[] jj_la1 = new int[261]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -8284,22 +8364,23 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { 0x84000000, 0x84000000, 0xd4000000, 0x0, 0x0, 0x0, 0x0, 0x50000000, 0x2, 0x2, 0x3f000, 0x2, 0x0, 0x2, 0x3f000, 0x0, 0x2, 0x0, 0x2, 0x0, 0x2, 0x200000, 0x0, 0xd4c40000, 0x0, - 0x134e0002, 0x2, 0xd4c40000, 0x2, 0x0, 0x2, 0x134e0002, 0x0, - 0x2, 0xd4c40000, 0x2, 0x134e0002, 0x2, 0x2, 0x2, 0x0, 0x2, - 0xd4c40000, 0x2, 0x2, 0x100000, 0x2, 0x2, 0x2, 0x2, 0x0, 0x2, - 0xd4c40000, 0xd4c40000, 0x2, 0x100000, 0x2, 0x2, 0x2, 0x100000, - 0x0, 0x0, 0x800c0000, 0x2, 0x0, 0x100000, 0x2, 0x800c0000, 0x2, - 0x0, 0x2, 0x0, 0x2, 0x2, 0x200000, 0x2, 0xd4c40000, 0x2, - 0x200400, 0x2, 0x2, 0x0, 0x2, 0x0, 0x2, 0x2, 0x2, 0x100000, - 0x2, 0x2, 0x2, 0x2, 0x2, 0x0, 0x2, 0x2, 0x2, 0x100000, 0x2, - 0x2, 0x2, 0x0, 0x2, 0x2, 0x2, 0x100000, 0x2, 0x2, 0x0, 0x2, - 0x0, 0x2, 0x2, 0x2, 0x100000, 0x0, 0x2, 0x2, 0x0, 0x2, 0x2, - 0x2, 0x200000, 0x2, 0x2, 0x200000, 0x2, 0x2, 0x0, 0x200000, - 0x2, 0x0, 0x2, 0x0, 0xd4c40000, 0x2, 0x0, 0x2, 0x0, 0x200000, - 0x2, 0x0, 0x2, 0x800c0400, 0x2, 0x0, 0x2, 0x2, 0x2, 0x2, 0x2, - 0x2, 0x2, 0x2, 0x321c0000, 0xc0000, 0x800c0000, 0xc0000, 0x0, - 0x80000000, 0x0, 0x80000000, 0x800c0000, 0x2, 0x2, 0x800c0000, - 0x2, 0xd4c40000, 0x2, 0x2, 0x2, 0x0, 0x200000, 0x2, 0x0, 0x2, }; + 0x134e0002, 0x2, 0xd4c40000, 0xd4c40000, 0x2, 0x0, 0x2, + 0x134e0002, 0x0, 0x2, 0xd4c40000, 0xd4c40000, 0x2, 0x134e0002, + 0x2, 0x2, 0x2, 0x0, 0x2, 0xd4c40000, 0x2, 0x2, 0x100000, 0x2, + 0x2, 0x2, 0x2, 0x0, 0x2, 0xd4c40000, 0xd4c40000, 0x2, 0x100000, + 0x2, 0x2, 0x2, 0x100000, 0x0, 0x0, 0x800c0000, 0x2, 0x0, + 0x100000, 0x2, 0x800c0000, 0x2, 0x0, 0x2, 0x0, 0x2, 0x2, + 0x200000, 0x2, 0xd4c40000, 0x2, 0x200400, 0x2, 0x2, 0x0, 0x2, + 0x0, 0x2, 0x2, 0x2, 0x100000, 0x2, 0x2, 0x2, 0x2, 0x2, 0x0, + 0x2, 0x2, 0x2, 0x100000, 0x2, 0x2, 0x2, 0x0, 0x2, 0x2, 0x2, + 0x100000, 0x2, 0x2, 0x0, 0x2, 0x0, 0x2, 0x2, 0x2, 0x100000, + 0x0, 0x2, 0x2, 0x0, 0x2, 0x2, 0x2, 0x200000, 0x2, 0x2, + 0x200000, 0x2, 0x2, 0x0, 0x200000, 0x2, 0x0, 0x2, 0x0, + 0xd4c40000, 0x2, 0x0, 0x2, 0x0, 0x200000, 0x2, 0x0, 0x2, + 0x800c0400, 0x2, 0x0, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, + 0x321c0000, 0xc0000, 0x800c0000, 0xc0000, 0x0, 0x80000000, 0x0, + 0x80000000, 0x800c0000, 0x2, 0x2, 0x800c0000, 0x2, 0xd4c40000, + 0x2, 0x2, 0x2, 0x0, 0x200000, 0x2, 0x0, 0x2, }; } private static void jj_la1_init_1() { @@ -8314,21 +8395,21 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50000000, 0x64000c0, 0x50000000, 0x3f, - 0x0, 0x564000c0, 0x0, 0x80000000, 0x0, 0x3f, 0x0, 0x0, - 0x564000c0, 0x0, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x564000c0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x564000c0, - 0x564000c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x40, 0x160040, - 0x0, 0x40, 0x0, 0x0, 0x160040, 0x0, 0x40, 0x0, 0x80, 0x0, 0x0, - 0x0, 0x0, 0x60000c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x6000000, 0x0, 0x0, 0x60000, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, - 0x80, 0x0, 0x6000000, 0xc0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, - 0x80, 0x0, 0x160000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x160000, 0x0, 0x0, 0x0, 0x160000, - 0x160000, 0x160000, 0x0, 0x0, 0x160000, 0x0, 0x60000c0, 0x0, - 0x0, 0x0, 0x80, 0x0, 0x0, 0x80, 0x0, }; + 0x0, 0x564000c0, 0x564000c0, 0x0, 0x80000000, 0x0, 0x3f, 0x0, + 0x0, 0x564000c0, 0x564000c0, 0x0, 0x3f, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x564000c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, + 0x564000c0, 0x564000c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, + 0x40, 0x160040, 0x0, 0x40, 0x0, 0x0, 0x160040, 0x0, 0x40, 0x0, + 0x80, 0x0, 0x0, 0x0, 0x0, 0x60000c0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x6000000, 0x0, + 0x0, 0x60000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x80, 0x0, 0x0, 0x80, 0x0, 0x6000000, 0xc0, 0x0, 0x0, 0x0, + 0x80, 0x0, 0x0, 0x80, 0x0, 0x160000, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x160000, 0x0, 0x0, 0x0, + 0x160000, 0x160000, 0x160000, 0x0, 0x0, 0x160000, 0x0, + 0x60000c0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x80, 0x0, }; } private static void jj_la1_init_2() { @@ -8342,48 +8423,48 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { 0x0, 0x100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100, 0x100, 0x100, 0x100, 0x100, 0x100, 0x0, 0x0, 0x0, 0x0, 0x180, 0x0, 0x0, 0x0, 0x0, 0x100, 0x0, 0x40, 0x0, 0x0, - 0x0, 0x109, 0x1000, 0x1300, 0x0, 0x1109, 0x0, 0x0, 0x0, 0x1300, - 0x20, 0x0, 0x1109, 0x0, 0x1300, 0x0, 0x0, 0x0, 0x1100, 0x0, - 0x1109, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100, 0x0, 0x1109, - 0x1109, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000, 0x1000, - 0xfffffb80, 0x0, 0x0, 0x0, 0x0, 0xfffffb80, 0x0, 0x0, 0x0, - 0x1100, 0x0, 0x0, 0x0, 0x0, 0x100, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x109, 0x1000, 0x1300, 0x0, 0x1109, 0x1109, 0x0, 0x0, 0x0, + 0x1300, 0x20, 0x0, 0x1109, 0x1109, 0x0, 0x1300, 0x0, 0x0, 0x0, + 0x1100, 0x0, 0x1109, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100, + 0x0, 0x1109, 0x1109, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1000, + 0x1000, 0xfffffb80, 0x0, 0x0, 0x0, 0x0, 0xfffffb80, 0x0, 0x0, + 0x0, 0x1100, 0x0, 0x0, 0x0, 0x0, 0x100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x1000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100, 0x0, - 0x0, 0x100, 0x0, 0x0, 0x100, 0x0, 0x0, 0x0, 0x100, 0x0, 0x0, - 0x100, 0x0, 0xfffffb80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0xfffffb80, 0x0, 0xffffe200, 0x0, 0x100, - 0x980, 0xffffeb80, 0x0, 0x0, 0xfffffb80, 0x0, 0x100, 0x0, 0x0, - 0x0, 0x100, 0x0, 0x0, 0x100, 0x0, }; + 0x0, 0x0, 0x0, 0x1000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100, + 0x0, 0x0, 0x100, 0x0, 0x0, 0x100, 0x0, 0x0, 0x0, 0x100, 0x0, + 0x0, 0x100, 0x0, 0xfffffb80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0xfffffb80, 0x0, 0xffffe200, 0x0, + 0x100, 0x980, 0xffffeb80, 0x0, 0x0, 0xfffffb80, 0x0, 0x100, + 0x0, 0x0, 0x0, 0x100, 0x0, 0x0, 0x100, 0x0, }; } private static void jj_la1_init_3() { jj_la1_3 = new int[] { 0x8, 0x80, 0x80, 0x2, 0x80, 0x0, 0x0, 0x0, 0x75, 0x0, 0x80, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x45, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc5, 0xc5, 0x0, 0x0, 0x0, 0xc401bf, 0xc401bf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc401be, 0x0, 0x0, 0x0, 0x0, 0x0, 0x400000, 0x400000, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x47, 0x47, 0x0, 0x0, 0x0, 0x1, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc7, 0xc7, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x400000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, - 0x200000, 0x0, 0x45, 0x0, 0x0, 0x0, 0x200000, 0x0, 0x0, 0x45, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x400000, 0x0, 0x75, 0x75, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x440001, 0x0, 0x0, 0x0, 0x0, 0x440001, - 0x0, 0x0, 0x0, 0x400000, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, - 0x0, 0x0, 0x380000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x400000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x80, + 0x200000, 0x0, 0xe5, 0xe5, 0x0, 0x0, 0x0, 0x200000, 0x0, 0x0, + 0xe5, 0xe5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc5, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x400000, 0x0, 0xd5, 0xd5, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x440001, 0x0, 0x0, 0x0, 0x0, + 0x440001, 0x0, 0x0, 0x0, 0x400000, 0x0, 0x0, 0x0, 0x0, 0x1, + 0x0, 0x0, 0x0, 0x0, 0x380000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x100, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x440001, 0x0, 0x100, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x440001, 0x0, 0x400000, - 0x0, 0x0, 0x40001, 0x440001, 0x0, 0x0, 0x440001, 0x0, 0x37, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, + 0x100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x440001, 0x0, 0x100, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x440001, 0x0, + 0x400000, 0x0, 0x0, 0x40001, 0x440001, 0x0, 0x0, 0x440001, 0x0, + 0x37, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; } final private JJCalls[] jj_2_rtns = new JJCalls[9]; @@ -8396,7 +8477,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 259; i++) { + for (int i = 0; i < 261; i++) { jj_la1[i] = -1; } for (int i = 0; i < jj_2_rtns.length; i++) { @@ -8410,7 +8491,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 259; i++) { + for (int i = 0; i < 261; i++) { jj_la1[i] = -1; } for (int i = 0; i < jj_2_rtns.length; i++) { @@ -8424,7 +8505,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 259; i++) { + for (int i = 0; i < 261; i++) { jj_la1[i] = -1; } for (int i = 0; i < jj_2_rtns.length; i++) { @@ -8438,7 +8519,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 259; i++) { + for (int i = 0; i < 261; i++) { jj_la1[i] = -1; } for (int i = 0; i < jj_2_rtns.length; i++) { @@ -8589,7 +8670,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 259; i++) { + for (int i = 0; i < 261; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1 << j)) != 0) { diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj index 871be2c4d0..26707b4955 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj +++ b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj @@ -1526,8 +1526,8 @@ void controlDirective() : void ifContentStatement() : {} { - contentDirective() | includeDirective() | media() | extendDirective() | styleRuleOrDeclarationOrNestedProperties() - | keyframes() | LOOKAHEAD(variable()) variable() | listModifyDirective() | controlDirective() + contentDirective() | includeDirective() | media() | extendDirective() | styleRuleOrDeclarationOrNestedProperties() + | keyframes() | LOOKAHEAD(variable()) variable() | listModifyDirective() | controlDirective() | atRuleDeclaration() } void ifDirective() : @@ -1543,7 +1543,7 @@ void ifDirective() : { documentHandler.startIfElseDirective(); documentHandler.ifDirective(evaluator); } - ( ifContentStatement() )* + ( ifContentStatement() | fontFace() )* < RBRACE >(< S >)* (elseDirective())* { documentHandler.endIfElseDirective(); } @@ -1562,7 +1562,7 @@ void elseDirective() : { if(!evaluator.trim().equals("")){ documentHandler.ifDirective(evaluator); } else{ documentHandler.elseDirective(); } } - ( ifContentStatement() )* + ( ifContentStatement() | fontFace() )* < RBRACE >(< S >)* } @@ -2382,8 +2382,9 @@ LexicalUnitImpl nonVariableTerm(LexicalUnitImpl prev) :
{
LexicalUnitImpl result && (Character.isDigit(s.charAt(i)) || (s.charAt(i) == '.'))) { i++; } + result = LexicalUnitImpl.createDimen(n.beginLine, n.beginColumn, prev, - Float.valueOf(s.substring(0, i)).floatValue(), + number(op,n,s.length()-i), s.substring(i)); } | result=function(op, prev) ) ) diff --git a/theme-compiler/tests/resources/automatic/css/at-directive-in-if.css b/theme-compiler/tests/resources/automatic/css/at-directive-in-if.css new file mode 100644 index 0000000000..80d4821ead --- /dev/null +++ b/theme-compiler/tests/resources/automatic/css/at-directive-in-if.css @@ -0,0 +1 @@ +@font-face {}
\ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/css/negative-ch-value.css b/theme-compiler/tests/resources/automatic/css/negative-ch-value.css new file mode 100644 index 0000000000..2cc75b2a6d --- /dev/null +++ b/theme-compiler/tests/resources/automatic/css/negative-ch-value.css @@ -0,0 +1,3 @@ +* { + top: -0.1ch; +}
\ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/scss/at-directive-in-if.scss b/theme-compiler/tests/resources/automatic/scss/at-directive-in-if.scss new file mode 100644 index 0000000000..30556fb382 --- /dev/null +++ b/theme-compiler/tests/resources/automatic/scss/at-directive-in-if.scss @@ -0,0 +1,8 @@ +@mixin test($italic: true) { + @if $italic { + @font-face { + } + } +} + +@include test;
\ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/scss/negative-ch-value.scss b/theme-compiler/tests/resources/automatic/scss/negative-ch-value.scss new file mode 100644 index 0000000000..2cc75b2a6d --- /dev/null +++ b/theme-compiler/tests/resources/automatic/scss/negative-ch-value.scss @@ -0,0 +1,3 @@ +* { + top: -0.1ch; +}
\ No newline at end of file diff --git a/uitest/ivy.xml b/uitest/ivy.xml index d75a591f94..9c86b2b68c 100644 --- a/uitest/ivy.xml +++ b/uitest/ivy.xml @@ -73,7 +73,8 @@ <dependency org="junit" name="junit" rev="4.11" conf="build,ide -> default" /> - + <dependency org="com.jcraft" name="jsch" rev="0.1.50" + conf="ide, build->default" /> <dependency org="commons-codec" name="commons-codec" rev="1.5" conf="build,ide->default" /> <dependency org="commons-io" name="commons-io" rev="2.2" diff --git a/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.html b/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.html new file mode 100644 index 0000000000..6fd54ba0ca --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.html @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>TableHorizontalScrollPositionOnItemSetChange</title> +</head> +<body> + <table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">TableHorizontalScrollPositionOnItemSetChange</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.table.TableHorizontalScrollPositionOnItemSetChange?restartApplication</td> + <td></td> + </tr> + <tr> + <td>scrollLeft</td> + <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Shorscrolltable/domChild[1]</td> + <td>326</td> + </tr> + <tr> + <td>pause</td> + <td>500</td> + <td></td> + </tr> + <tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Slessitems/domChild[0]/domChild[0]</td> + <td></td> + </tr> + <tr> + <td>pause</td> + <td>500</td> + <td></td> + </tr> + <tr> + <td>screenCapture</td> + <td></td> + <td>left-scroll-position-stays-in-middle-with-fewer-items</td> + </tr> + <tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Smoreitems/domChild[0]/domChild[0]</td> + <td></td> + </tr> + <tr> + <td>pause</td> + <td>500</td> + <td></td> + </tr> + <tr> + <td>screenCapture</td> + <td></td> + <td>left-scroll-position-stays-in-middle-with-more-items</td> + </tr> + <tr> + <td>scrollLeft</td> + <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Shorscrolltable/domChild[1]</td> + <td>653</td> + </tr> + <tr> + <td>pause</td> + <td>500</td> + <td></td> + </tr> + <tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Slessitems/domChild[0]/domChild[0]</td> + <td></td> + </tr> + <tr> + <td>pause</td> + <td>500</td> + <td></td> + </tr> + <tr> + <td>screenCapture</td> + <td></td> + <td>left-scroll-position-stays-max-with-fewer-items</td> + </tr> + <tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Smoreitems/domChild[0]/domChild[0]</td> + <td></td> + </tr> + <tr> + <td>pause</td> + <td>500</td> + <td></td> + </tr> + <tr> + <td>screenCapture</td> + <td></td> + <td>left-scroll-position-stays-max-with-more-items</td> + </tr> + <tr> + <td>scrollLeft</td> + <td>vaadin=runcomvaadintestscomponentstableTableHorizontalScrollPositionOnItemSetChange::PID_Shorscrolltable/domChild[1]</td> + <td>0</td> + </tr> + </tbody> + </table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.java b/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.java new file mode 100644 index 0000000000..1f59a84428 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableHorizontalScrollPositionOnItemSetChange.java @@ -0,0 +1,101 @@ +/* + * 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.tests.components.table; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Table; +import com.vaadin.ui.VerticalLayout; + +public class TableHorizontalScrollPositionOnItemSetChange extends + AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + VerticalLayout layout = new VerticalLayout(); + layout.setMargin(true); + layout.setSpacing(true); + setContent(layout); + + final Table table = new Table(); + table.setWidth("640px"); + table.setHeight("243px"); + table.setId("horscrolltable"); + layout.addComponent(table); + + for (int i = 0; i < 15; i++) { + table.addContainerProperty("Column " + i, String.class, null); + } + + for (int i = 0; i < 60; i++) { + table.addItem(); + } + + Button lessItems = new Button("Less items", new Button.ClickListener() { + + @Override + public void buttonClick(Button.ClickEvent event) { + table.removeAllItems(); + for (int i = 0; i < 5; i++) { + table.addItem(); + } + } + }); + lessItems.setId("lessitems"); + + Button moreItems = new Button("More items", new Button.ClickListener() { + + @Override + public void buttonClick(Button.ClickEvent event) { + table.removeAllItems(); + for (int i = 0; i < 50; i++) { + table.addItem(); + } + } + }); + moreItems.setId("moreitems"); + + Button clearItems = new Button("Clear all", new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + table.removeAllItems(); + } + }); + + HorizontalLayout buttonLayout = new HorizontalLayout(); + buttonLayout.setSpacing(true); + layout.addComponent(buttonLayout); + + buttonLayout.addComponent(lessItems); + buttonLayout.addComponent(moreItems); + buttonLayout.addComponent(clearItems); + clearItems.setId("clearitems"); + } + + @Override + protected String getTestDescription() { + return "Horizontal scrolling position should not be lost if amount of items changes in Table."; + } + + @Override + protected Integer getTicketNumber() { + return 12652; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheet.java b/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheet.java new file mode 100644 index 0000000000..f84f83718d --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheet.java @@ -0,0 +1,69 @@ +/* + * 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.tests.components.table; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Component; +import com.vaadin.ui.CustomComponent; +import com.vaadin.ui.Layout; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.Table; +import com.vaadin.ui.VerticalLayout; + +@SuppressWarnings("serial") +public class TableSizeInTabsheet extends AbstractTestUI { + + static final String TABLE = "table"; + static final String TABSHEET = "tabsheet"; + + @Override + protected void setup(VaadinRequest request) { + VerticalLayout layout = new VerticalLayout(); + layout.setMargin(true); + setContent(layout); + + TabSheet tabSheet = new TabSheet(); + tabSheet.setId(TABSHEET); + layout.addComponent(tabSheet); + tabSheet.addTab(new TabComposite(), "Tab"); + } + + public class TabComposite extends CustomComponent { + + public TabComposite() { + Layout mainLayout = new VerticalLayout(); + addComponent(mainLayout); + setCompositionRoot(mainLayout); + + Component table = new Table(); + table.setWidth("100%"); + table.setId(TABLE); + mainLayout.addComponent(table); + } + } + + @Override + protected String getTestDescription() { + return "The size calculations fails in IE8 when undefined size table is inside a tabsheet"; + } + + @Override + protected Integer getTicketNumber() { + return 12687; + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheetTest.java b/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheetTest.java new file mode 100644 index 0000000000..29fc5a2e52 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/TableSizeInTabsheetTest.java @@ -0,0 +1,50 @@ +/* + * 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.tests.components.table; + +import static com.vaadin.tests.components.table.TableSizeInTabsheet.TABLE; +import static com.vaadin.tests.components.table.TableSizeInTabsheet.TABSHEET; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class TableSizeInTabsheetTest extends MultiBrowserTest { + + private static final String TABSHEET_CONTENT_STYLENAME = "v-tabsheet-content"; + + @Test + public void testTabsheetContentHasTheSameHeightAsTable() { + openTestURL(); + int tableHeight = getTableHeigth(); + int tabSheetContentHeight = getTableSheetContentHeight(); + + Assert.assertEquals(tableHeight, tabSheetContentHeight); + } + + private int getTableHeigth() { + return vaadinElementById(TABLE).getSize().getHeight(); + } + + private int getTableSheetContentHeight() { + WebElement tabsheetContent = vaadinElementById(TABSHEET).findElement( + By.className(TABSHEET_CONTENT_STYLENAME)); + return tabsheetContent.getSize().getHeight(); + } +} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java new file mode 100644 index 0000000000..02482b7049 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltip.java @@ -0,0 +1,60 @@ +/* + * 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.tests.components.tabsheet; + +import com.vaadin.server.UserError; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Label; +import com.vaadin.ui.TabSheet; +import com.vaadin.ui.TabSheet.Tab; + +public class TabSheetErrorTooltip extends AbstractTestUI { + + private TabSheet tabSheet = new TabSheet(); + private int tabCount = 0; + + @Override + protected void setup(VaadinRequest request) { + + addTab(); + addTab().setComponentError(new UserError("Error!")); + addTab().setDescription("This is a tab"); + + Tab t = addTab(); + t.setComponentError(new UserError("Error!")); + t.setDescription("This tab has both an error and a description"); + + setContent(tabSheet); + } + + private Tab addTab() { + tabCount++; + Label contents = new Label("Contents for tab " + tabCount); + return tabSheet.addTab(contents, "Tab " + tabCount); + } + + @Override + protected String getTestDescription() { + return "TabSheet Tabs should display component error tooltips when expected"; + } + + @Override + protected Integer getTicketNumber() { + return 12802; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java new file mode 100644 index 0000000000..88bc23d12b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetErrorTooltipTest.java @@ -0,0 +1,81 @@ +/* + * 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.tests.components.tabsheet; + +import java.io.IOException; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.WebElement; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class TabSheetErrorTooltipTest extends MultiBrowserTest { + + @Test + public void checkTooltips() throws IOException { + openTestURL(); + + testBenchElement(getTab(0)).showTooltip(); + assertNoTooltip(); + + testBenchElement(getTab(1)).showTooltip(); + assertErrorMessage("Error!"); + assertTooltip(""); + + testBenchElement(getTab(2)).showTooltip(); + assertErrorMessage(""); + assertTooltip("This is a tab"); + + testBenchElement(getTab(3)).showTooltip(); + assertErrorMessage("Error!"); + assertTooltip("This tab has both an error and a description"); + } + + private WebElement getTab(int index) { + return vaadinElement("/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[" + + index + "]/domChild[0]"); + } + + private WebElement getTooltip() { + return getDriver().findElement( + By.xpath("//div[@class='v-tooltip-text']")); + } + + private WebElement getErrorMessage() { + return getDriver().findElement( + By.xpath("//div[@class='v-errormessage']")); + } + + private void assertTooltip(String tooltip) { + Assert.assertEquals(tooltip, getTooltip().getText()); + } + + private void assertErrorMessage(String message) { + Assert.assertEquals(message, getErrorMessage().getText()); + } + + private void assertNoTooltip() { + try { + getTooltip(); + } catch (NoSuchElementException e) { + return; + } + Assert.fail("Tooltip exists"); + } +} diff --git a/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindow.java b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindow.java new file mode 100644 index 0000000000..6347ff9a76 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindow.java @@ -0,0 +1,66 @@ +/* + * 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.tests.components.window; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class ComboboxScrollableWindow extends AbstractTestUI { + + static final String WINDOW_ID = "window"; + static final String COMBOBOX_ID = "combobox"; + + @Override + protected void setup(VaadinRequest request) { + + Window w = new Window(); + w.setId(WINDOW_ID); + w.setWidth("300px"); + w.setHeight("300px"); + w.center(); + + VerticalLayout content = new VerticalLayout(); + w.setContent(content); + content.setHeight("1000px"); + ComboBox cb = new ComboBox(); + cb.setId(COMBOBOX_ID); + content.addComponent(cb); + content.setComponentAlignment(cb, Alignment.BOTTOM_CENTER); + + addWindow(w); + + } + + @Override + protected String getTestDescription() { + return "The combo box in the bottom of the scrollable window should remain visible when it is clicked."; + } + + @Override + protected Integer getTicketNumber() { + return 12736; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java new file mode 100644 index 0000000000..665e175f2c --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/ComboboxScrollableWindowTest.java @@ -0,0 +1,57 @@ +/* + * 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.tests.components.window; + +import static com.vaadin.tests.components.window.ComboboxScrollableWindow.COMBOBOX_ID; +import static com.vaadin.tests.components.window.ComboboxScrollableWindow.WINDOW_ID; + +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.commands.TestBenchElementCommands; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class ComboboxScrollableWindowTest extends MultiBrowserTest { + + @Test + public void testWindowScrollbars() throws Exception { + openTestURL(); + com.vaadin.testbench.Parameters + .setScreenshotComparisonCursorDetection(true); + + WebElement window = driver.findElement(By.id(WINDOW_ID)); + WebElement scrollableElement = window.findElement(By + .className("v-scrollable")); + TestBenchElementCommands scrollable = testBenchElement(scrollableElement); + scrollable.scroll(1000); + WebElement comboBox = driver.findElement(By.id(COMBOBOX_ID)); + WebElement selectButton = driver.findElement(By + .className("v-filterselect-button")); + selectButton.click(); + + // Wait for the browser before taking a screenshot + Thread.sleep(1000); + compareScreen(getScreenshotBaseName()); + + } + +} diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMoveListener.java b/uitest/src/com/vaadin/tests/components/window/WindowMoveListener.java new file mode 100644 index 0000000000..e0bc0d9471 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/WindowMoveListener.java @@ -0,0 +1,67 @@ +package com.vaadin.tests.components.window; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Window; + +@SuppressWarnings("serial") +public class WindowMoveListener extends AbstractTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + + Window w = new Window("Caption"); + w.setId("testwindow"); + w.setHeight("100px"); + w.setWidth("100px"); + w.setPositionX(100); + w.setPositionY(100); + addWindow(w); + + Button b = new Button(); + b.setId("testbutton"); + addComponent(b); + b.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + for (Window window : getWindows()) { + window.setPositionX(100); + window.setPositionY(100); + } + } + }); + + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Tests that windows send their updated position " + + "to server-side after being moved by user"; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 12885; + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java b/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java new file mode 100644 index 0000000000..3ea3b719c0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/WindowMoveListenerTest.java @@ -0,0 +1,50 @@ +package com.vaadin.tests.components.window; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.Point; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Action; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class WindowMoveListenerTest extends MultiBrowserTest { + + @Test + public void testWindowRepositioning() throws Exception { + openTestURL(); + + WebElement window = getDriver().findElement(By.id("testwindow")); + WebElement button = getDriver().findElement(By.id("testbutton")); + + // I'd loved to use the header, but that doesn't work. Footer works + // fine, though :) + WebElement windowHeader = getDriver().findElement( + By.className("v-window-footer")); + + Point winPos = window.getLocation(); + + // move window + Action a = new Actions(driver).clickAndHold(windowHeader) + .moveByOffset(100, 100).release().build(); + a.perform(); + + assertNotEquals("Window was not dragged correctly.", winPos.x, + window.getLocation().x); + assertNotEquals("Window was not dragged correctly.", winPos.y, + window.getLocation().y); + + // re-set window + button.click(); + + assertEquals("Window was not re-positioned correctly.", winPos.x, + window.getLocation().x); + assertEquals("Window was not re-positioned correctly.", winPos.y, + window.getLocation().y); + + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java index 221680be11..f55867c464 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java @@ -124,6 +124,13 @@ public class GridLayoutTests extends AbstractLayoutTests { final Button button5 = new Button("Test remove row 0"); final Button button6 = new Button("Test remove comp row3"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + button5.setId("testButton5"); + button6.setId("testButton6"); + baseLayout.addComponent(button1); baseLayout.addComponent(button2); baseLayout.addComponent(button3); @@ -223,6 +230,10 @@ public class GridLayoutTests extends AbstractLayoutTests { final Button button4 = new Button("undefined size+add, table"); glo.replaceComponent(x22, x22 = getTestTable()); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); baseLayout.addComponent(button1); baseLayout.addComponent(button2); @@ -287,6 +298,11 @@ public class GridLayoutTests extends AbstractLayoutTests { final Button button2 = new Button("set all cols expand 0.25"); final Button button3 = new Button("set row 0 expand 0.5"); final Button button4 = new Button("set row 3 expand 0.2"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + glo.setHeight("400px"); glo.replaceComponent(x22, x22 = getTestTable()); @@ -396,6 +412,11 @@ public class GridLayoutTests extends AbstractLayoutTests { final Button button3 = new Button("Set fixed width and height 75%"); final Button button4 = new Button("Set size full"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + glo.replaceComponent(x22, x22 = getTestTable()); baseLayout.addComponent(button1); @@ -467,6 +488,11 @@ public class GridLayoutTests extends AbstractLayoutTests { final Button button3 = new Button("Set margin off"); final Button button4 = new Button("Set spacing off"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + baseLayout.addComponent(button1); baseLayout.addComponent(button2); baseLayout.addComponent(button3); diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java index 7a53a6583e..971205ccbb 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java @@ -123,7 +123,10 @@ public class HorizontalLayoutTests extends AbstractLayoutTests { final Button replaceButton = new Button("Test replace"); final Button moveButton = new Button("Test move"); final Button removeButton = new Button("Test remove"); - + addButton.setId("testButton1"); + replaceButton.setId("testButton2"); + moveButton.setId("testButton3"); + removeButton.setId("testButton4"); replaceButton.setEnabled(false); moveButton.setEnabled(false); removeButton.setEnabled(false); @@ -193,6 +196,10 @@ public class HorizontalLayoutTests extends AbstractLayoutTests { final Button smallerButton = new Button("200 px width"); final Button originalButton = new Button("undefined size+add"); + biggerButton.setId("testButton1"); + smallerButton.setId("testButton2"); + originalButton.setId("testButton3"); + baseLayout.addComponent(biggerButton); baseLayout.addComponent(smallerButton); baseLayout.addComponent(originalButton); @@ -257,6 +264,11 @@ public class HorizontalLayoutTests extends AbstractLayoutTests { final Button button3 = new Button("Set fixed width and height 75%"); final Button button4 = new Button("Set size full"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + baseLayout.addComponent(button1); baseLayout.addComponent(button2); baseLayout.addComponent(button3); @@ -332,6 +344,9 @@ public class HorizontalLayoutTests extends AbstractLayoutTests { final Button button1 = new Button("Expand to 1/undefined"); final Button button2 = new Button("Expand to 0.5/0.5"); final Button button3 = new Button("Expand to 0.75/0.25"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); baseLayout.addComponent(button1); baseLayout.addComponent(button2); @@ -438,6 +453,10 @@ public class HorizontalLayoutTests extends AbstractLayoutTests { final Button button2 = new Button("Set spacing on"); final Button button3 = new Button("Set margin off"); final Button button4 = new Button("Set spacing off"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); baseLayout.addComponent(button1); baseLayout.addComponent(button2); diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.html b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.html deleted file mode 100644 index 8408aba9fd..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.html +++ /dev/null @@ -1,896 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>LayoutTesterApplication</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">LayoutTesterApplication</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.layouts.layouttester.LayoutTesterApplication?restartApplication</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>2</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>3</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>4</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>5</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>6</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>7</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>8</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>9</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>10</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>11</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>12</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>13</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>14</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>15</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>16</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>17</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>18</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>19</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>20</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>21</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>22</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>23</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>24</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>25</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>26</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>27</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>28</td> -</tr> -<tr> - <td>select</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VNativeSelect[0]/domChild[0]</td> - <td>label=class com.vaadin.ui.HorizontalLayout</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>29</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>30</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>31</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>32</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>33</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>34</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>35</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>36</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>37</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>38</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>39</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>40</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>41</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>42</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>43</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>44</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>45</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>46</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>47</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>48</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>49</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>50</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>51</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>52</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>53</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>54</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>55</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>56</td> -</tr> -<tr> - <td>select</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VNativeSelect[0]/domChild[0]</td> - <td>label=class com.vaadin.ui.GridLayout</td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>57</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>58</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>59</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>60</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>61</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>62</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>63</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>64</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>65</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>66</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>67</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>68</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>69</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>70</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>71</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>72</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>73</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>74</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>75</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>76</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>77</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>78</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>79</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>80</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>81</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>82</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>83</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>84</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>85</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>86</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>87</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestslayoutslayouttesterLayoutTesterApplication::/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>88</td> -</tr> -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java index 72863895a1..5b68e04144 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java @@ -20,18 +20,20 @@ public class LayoutTesterApplication extends AbstractTestCase { Button nextButton = new Button("Next"); private int layoutIndex = -1; - private static final String[] layoutGetters = new String[] { - "getCaptionsTests", "getIconsTests", - "getRequiredErrorIndicatorsTests", "getAlignmentTests", - "getExpandRatiosTests", "getMarginSpacingTests", - "getComponentAddReplaceMoveTests", "getComponentSizingTests", - "getLayoutSizingTests" }; + static final String[] layoutGetters = new String[] { "getCaptionsTests", + "getIconsTests", "getRequiredErrorIndicatorsTests", + "getAlignmentTests", "getExpandRatiosTests", + "getMarginSpacingTests", "getComponentAddReplaceMoveTests", + "getComponentSizingTests", "getLayoutSizingTests" }; + public static final String NEXT_BUTTON_ID = "nextButton"; + private static final String LAYOUT_SELECT_ID = "layoutSelect"; private LegacyWindow mainWindow; private NativeSelect layoutSelector; @Override public void init() { + nextButton.setId(NEXT_BUTTON_ID); mainWindow = new LegacyWindow("LayoutTesterApplication"); setMainWindow(mainWindow); nextLayout(); @@ -112,6 +114,7 @@ public class LayoutTesterApplication extends AbstractTestCase { private NativeSelect getLayoutTypeSelect() { if (layoutSelector == null) { layoutSelector = new NativeSelect(); + layoutSelector.setId(LAYOUT_SELECT_ID); layoutSelector.addItem(VerticalLayout.class); layoutSelector.addItem(HorizontalLayout.class); layoutSelector.addItem(GridLayout.class); diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplicationTest.java b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplicationTest.java new file mode 100644 index 0000000000..33197613dc --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplicationTest.java @@ -0,0 +1,137 @@ +/* + * 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.tests.layouts.layouttester; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.Select; + +import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.VerticalLayout; + +public class LayoutTesterApplicationTest extends MultiBrowserTest { + Map<String, Integer> numberOfSubTests = new HashMap<String, Integer>(); + private Set<String> tableOrIconsTests = new HashSet<String>(); + + { + numberOfSubTests.put("getExpandRatiosTests", 3); + numberOfSubTests.put("getLayoutSizingTests", 4); + numberOfSubTests.put("getComponentAddReplaceMoveTests", 4); + numberOfSubTests.put("getMarginSpacingTests", 4); + numberOfSubTests.put("getComponentSizingTests", 3); + + tableOrIconsTests.add("getComponentSizingTests"); + tableOrIconsTests.add("getExpandRatiosTests"); + tableOrIconsTests.add("getLayoutSizingTests"); + tableOrIconsTests.add("getMarginSpacingTests"); + tableOrIconsTests.add("getIconsTests"); + + } + + @Test + public void verticalLayout() throws Exception { + openTestURL(); + runTest(VerticalLayout.class); + } + + @Test + public void horizontalLayout() throws Exception { + openTestURL(); + runTest(HorizontalLayout.class); + } + + @Test + public void gridLayout() throws Exception { + numberOfSubTests.put("getComponentAddReplaceMoveTests", 6); + numberOfSubTests.put("getComponentSizingTests", 4); + numberOfSubTests.put("getExpandRatiosTests", 4); + + openTestURL(); + runTest(GridLayout.class); + } + + private void runTest(Class<?> layoutClass) throws Exception { + new Select(vaadinElementById("layoutSelect").findElement( + By.xpath("select"))) + .selectByVisibleText(layoutClass.toString()); + focusElementWithId("nextButton"); + + for (String subTest : LayoutTesterApplication.layoutGetters) { + compareScreen(subTest); + Integer subTests = numberOfSubTests.get(subTest); + if (subTests != null) { + for (int i = 1; i <= subTests; i++) { + clickAndCompareScreen(subTest, "testButton" + i); + } + } + getNextButton().click(); + } + + } + + /** + * @param elementId + * the id of the element to focus + */ + private void focusElementWithId(String elementId) { + // This should really be in TestBench + ((JavascriptExecutor) getDriver()) + .executeScript("document.getElementById('" + elementId + + "').focus()"); + } + + /** + * Clicks the button with the given id and compares the result to a + * screenshot named 'screenshotPrefix'-buttonCaption. + * + * @param screenshotPrefix + * @param buttonId + * @throws Exception + */ + private void clickAndCompareScreen(String screenshotPrefix, String buttonId) + throws Exception { + WebElement button = vaadinElementById(buttonId); + button.click(); + if (needsDelayToStabilize(screenshotPrefix)) { + // Table does some extra layout phase and TestBench does not always + // take this into account, grabbing screenshots before the layout + // phase is done (see #12866). + sleep(200); + } + compareScreen(screenshotPrefix + "-" + sanitize(button.getText())); + } + + private boolean needsDelayToStabilize(String screenshotPrefix) { + return tableOrIconsTests.contains(screenshotPrefix); + } + + private String sanitize(String text) { + return text.replace("%", "pct").replaceAll("[^a-zA-Z0-9]", "-"); + } + + private WebElement getNextButton() { + return vaadinElementById(LayoutTesterApplication.NEXT_BUTTON_ID); + } +} diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java index 7764589ff7..04cee2d68d 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java @@ -127,6 +127,10 @@ public class VerticalLayoutTests extends AbstractLayoutTests { final Button replaceButton = new Button("Test replace"); final Button moveButton = new Button("Test move"); final Button removeButton = new Button("Test remove"); + addButton.setId("testButton1"); + replaceButton.setId("testButton2"); + moveButton.setId("testButton3"); + removeButton.setId("testButton4"); replaceButton.setEnabled(false); moveButton.setEnabled(false); @@ -196,7 +200,9 @@ public class VerticalLayoutTests extends AbstractLayoutTests { final Button biggerButton = new Button("full size"); final Button smallerButton = new Button("200 px width"); final Button originalButton = new Button("undefined size and add"); - + biggerButton.setId("testButton1"); + smallerButton.setId("testButton2"); + originalButton.setId("testButton3"); vlo.addComponent(biggerButton); vlo.addComponent(smallerButton); vlo.addComponent(originalButton); @@ -265,6 +271,11 @@ public class VerticalLayoutTests extends AbstractLayoutTests { final Button button3 = new Button("Set fixed width and height 75%"); final Button button4 = new Button("Set size full"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); + vlo.addComponent(button1); vlo.addComponent(button2); vlo.addComponent(button3); @@ -344,8 +355,11 @@ public class VerticalLayoutTests extends AbstractLayoutTests { c2.setSizeFull(); final Button button1 = new Button("Expand to 1/undefined"); + button1.setId("testButton1"); final Button button2 = new Button("Expand to 0.5/0.5"); + button2.setId("testButton2"); final Button button3 = new Button("Expand to 0.75/0.25"); + button3.setId("testButton3"); vlo.addComponent(button1); vlo.addComponent(button2); @@ -460,6 +474,10 @@ public class VerticalLayoutTests extends AbstractLayoutTests { final Button button2 = new Button("Set spacing on"); final Button button3 = new Button("Set margin off"); final Button button4 = new Button("Set spacing off"); + button1.setId("testButton1"); + button2.setId("testButton2"); + button3.setId("testButton3"); + button4.setId("testButton4"); vlo.addComponent(button1); vlo.addComponent(button2); diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.java b/uitest/src/com/vaadin/tests/push/BasicPush.java index d6c45a2ed0..8e8f418c5f 100644 --- a/uitest/src/com/vaadin/tests/push/BasicPush.java +++ b/uitest/src/com/vaadin/tests/push/BasicPush.java @@ -30,6 +30,16 @@ import com.vaadin.ui.Label; @Push public class BasicPush extends AbstractTestUI { + public static final String CLIENT_COUNTER_ID = "clientCounter"; + + public static final String STOP_TIMER_ID = "stopTimer"; + + public static final String START_TIMER_ID = "startTimer"; + + public static final String SERVER_COUNTER_ID = "serverCounter"; + + public static final String INCREMENT_BUTTON_ID = "incrementCounter"; + private ObjectProperty<Integer> counter = new ObjectProperty<Integer>(0); private ObjectProperty<Integer> counter2 = new ObjectProperty<Integer>(0); @@ -48,15 +58,19 @@ public class BasicPush extends AbstractTestUI { */ Label lbl = new Label(counter); lbl.setCaption("Client counter (click 'increment' to update):"); + lbl.setId(CLIENT_COUNTER_ID); addComponent(lbl); - addComponent(new Button("Increment", new Button.ClickListener() { + Button incrementButton = new Button("Increment", + new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - counter.setValue(counter.getValue() + 1); - } - })); + @Override + public void buttonClick(ClickEvent event) { + counter.setValue(counter.getValue() + 1); + } + }); + incrementButton.setId(INCREMENT_BUTTON_ID); + addComponent(incrementButton); spacer(); @@ -65,33 +79,37 @@ public class BasicPush extends AbstractTestUI { */ lbl = new Label(counter2); lbl.setCaption("Server counter (updates each 3s by server thread) :"); + lbl.setId(SERVER_COUNTER_ID); addComponent(lbl); - addComponent(new Button("Start timer", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - counter2.setValue(0); - if (task != null) { - task.cancel(); - } - task = new TimerTask() { + Button startTimer = new Button("Start timer", + new Button.ClickListener() { @Override - public void run() { - access(new Runnable() { + public void buttonClick(ClickEvent event) { + counter2.setValue(0); + if (task != null) { + task.cancel(); + } + task = new TimerTask() { + @Override public void run() { - counter2.setValue(counter2.getValue() + 1); + access(new Runnable() { + @Override + public void run() { + counter2.setValue(counter2.getValue() + 1); + } + }); } - }); + }; + timer.scheduleAtFixedRate(task, 3000, 3000); } - }; - timer.scheduleAtFixedRate(task, 3000, 3000); - } - })); + }); + startTimer.setId(START_TIMER_ID); + addComponent(startTimer); - addComponent(new Button("Stop timer", new Button.ClickListener() { + Button stopTimer = new Button("Stop timer", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (task != null) { @@ -99,7 +117,9 @@ public class BasicPush extends AbstractTestUI { task = null; } } - })); + }); + stopTimer.setId(STOP_TIMER_ID); + addComponent(stopTimer); } @Override diff --git a/uitest/src/com/vaadin/tests/push/BasicPushTest.java b/uitest/src/com/vaadin/tests/push/BasicPushTest.java index 57af8524bc..ef40ae09dc 100644 --- a/uitest/src/com/vaadin/tests/push/BasicPushTest.java +++ b/uitest/src/com/vaadin/tests/push/BasicPushTest.java @@ -19,6 +19,7 @@ import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; +import com.vaadin.tests.tb3.AbstractTB3Test; import com.vaadin.tests.tb3.MultiBrowserTest; public abstract class BasicPushTest extends MultiBrowserTest { @@ -30,15 +31,13 @@ public abstract class BasicPushTest extends MultiBrowserTest { // Test client initiated push Assert.assertEquals(0, getClientCounter()); getIncrementButton().click(); - Assert.assertEquals( - "Client counter not incremented by button click", 1, - getClientCounter()); + Assert.assertEquals("Client counter not incremented by button click", + 1, getClientCounter()); getIncrementButton().click(); getIncrementButton().click(); getIncrementButton().click(); - Assert.assertEquals( - "Four clicks should have incremented counter to 4", 4, - getClientCounter()); + Assert.assertEquals("Four clicks should have incremented counter to 4", + 4, getClientCounter()); // Test server initiated push getServerCounterStartButton().click(); @@ -63,30 +62,47 @@ public abstract class BasicPushTest extends MultiBrowserTest { } private int getServerCounter() { - return Integer.parseInt(getServerCounterElement().getText()); + return getServerCounter(this); } private int getClientCounter() { - return Integer.parseInt(getClientCounterElement().getText()); + return getClientCounter(this); } - private WebElement getServerCounterElement() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]"); + public static int getClientCounter(AbstractTB3Test t) { + WebElement clientCounterElem = t + .vaadinElementById(BasicPush.CLIENT_COUNTER_ID); + return Integer.parseInt(clientCounterElem.getText()); } - private WebElement getServerCounterStartButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]"); + private WebElement getIncrementButton() { + return getIncrementButton(this); } private WebElement getServerCounterStopButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]"); + return getServerCounterStopButton(this); } - private WebElement getIncrementButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]"); + private WebElement getServerCounterStartButton() { + return getServerCounterStartButton(this); + } + + public static int getServerCounter(AbstractTB3Test t) { + WebElement serverCounterElem = t + .vaadinElementById(BasicPush.SERVER_COUNTER_ID); + return Integer.parseInt(serverCounterElem.getText()); } - private WebElement getClientCounterElement() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]"); + public static WebElement getServerCounterStartButton(AbstractTB3Test t) { + return t.vaadinElementById(BasicPush.START_TIMER_ID); } + + public static WebElement getServerCounterStopButton(AbstractTB3Test t) { + return t.vaadinElementById(BasicPush.STOP_TIMER_ID); + } + + public static WebElement getIncrementButton(AbstractTB3Test t) { + return t.vaadinElementById(BasicPush.INCREMENT_BUTTON_ID); + } + }
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/push/EnableDisablePush.java b/uitest/src/com/vaadin/tests/push/EnableDisablePush.java index 50dab43667..ac37e75fea 100644 --- a/uitest/src/com/vaadin/tests/push/EnableDisablePush.java +++ b/uitest/src/com/vaadin/tests/push/EnableDisablePush.java @@ -1,74 +1,19 @@ package com.vaadin.tests.push; -import static org.junit.Assert.assertEquals; - import java.util.Date; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.TimeUnit; -import org.junit.Test; -import org.openqa.selenium.WebElement; - import com.vaadin.server.VaadinRequest; import com.vaadin.shared.communication.PushMode; import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.UIDetachedException; public class EnableDisablePush extends AbstractTestUI { - public static class EnableDisablePushTest extends MultiBrowserTest { - @Test - public void testEnablePushWhenUsingPolling() throws Exception { - openTestURL(); - - assertEquals("1. Push enabled", getLogRow(0)); - - getDisablePushButton().click(); - assertEquals("3. Push disabled", getLogRow(0)); - - getEnablePollButton().click(); - assertEquals("5. Poll enabled", getLogRow(0)); - - getEnablePushButton().click(); - assertEquals("7. Push enabled", getLogRow(0)); - - getDisablePollButton().click(); - assertEquals("9. Poll disabled", getLogRow(0)); - - getDisablePushButtonAndReenableFromBackground().click(); - Thread.sleep(2500); - assertEquals("16. Polling disabled, push enabled", getLogRow(0)); - - getDisablePushButton().click(); - assertEquals("18. Push disabled", getLogRow(0)); - } - - private WebElement getDisablePushButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]"); - } - - private WebElement getEnablePushButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]"); - } - - private WebElement getDisablePollButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]"); - } - - private WebElement getEnablePollButton() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]"); - } - - private WebElement getDisablePushButtonAndReenableFromBackground() { - return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VButton[0]"); - } - - } - private int c = 0; private Log log = new Log(15); diff --git a/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java b/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java new file mode 100644 index 0000000000..275b6d5b53 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java @@ -0,0 +1,72 @@ +/* + * 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.tests.push; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class EnableDisablePushTest extends MultiBrowserTest { + @Test + public void testEnablePushWhenUsingPolling() throws Exception { + openTestURL(); + + assertEquals("1. Push enabled", getLogRow(0)); + + getDisablePushButton().click(); + assertEquals("3. Push disabled", getLogRow(0)); + + getEnablePollButton().click(); + assertEquals("5. Poll enabled", getLogRow(0)); + + getEnablePushButton().click(); + assertEquals("7. Push enabled", getLogRow(0)); + + getDisablePollButton().click(); + assertEquals("9. Poll disabled", getLogRow(0)); + + getDisablePushButtonAndReenableFromBackground().click(); + Thread.sleep(2500); + assertEquals("16. Polling disabled, push enabled", getLogRow(0)); + + getDisablePushButton().click(); + assertEquals("18. Push disabled", getLogRow(0)); + } + + private WebElement getDisablePushButton() { + return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]"); + } + + private WebElement getEnablePushButton() { + return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]"); + } + + private WebElement getDisablePollButton() { + return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]"); + } + + private WebElement getEnablePollButton() { + return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]"); + } + + private WebElement getDisablePushButtonAndReenableFromBackground() { + return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VButton[0]"); + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/push/PushLargeData.java b/uitest/src/com/vaadin/tests/push/PushLargeData.java index 8ad005df81..3b72424b32 100644 --- a/uitest/src/com/vaadin/tests/push/PushLargeData.java +++ b/uitest/src/com/vaadin/tests/push/PushLargeData.java @@ -34,6 +34,18 @@ import com.vaadin.ui.UI; public abstract class PushLargeData extends AbstractTestUIWithLog { + // 1MB + static final int DEFAULT_SIZE_BYTES = 1000 * 1000; + + // Every other second + static final int DEFAULT_DELAY_MS = 2000; + + // 20 MB is enough for streaming to reconnect + static final int DEFAULT_DATA_TO_PUSH = 20 * 1000 * 1000; + + static final int DEFAULT_DURATION_MS = DEFAULT_DATA_TO_PUSH + / DEFAULT_SIZE_BYTES * DEFAULT_DELAY_MS; + private Label dataLabel = new Label(); private final ExecutorService executor = Executors @@ -49,9 +61,9 @@ public abstract class PushLargeData extends AbstractTestUIWithLog { final TextField duration = new TextField("Duration (ms)"); duration.setConverter(Integer.class); - dataSize.setValue((1000 * 1000) + ""); - interval.setValue(2000 + ""); - duration.setValue(40 * 1000 + ""); + dataSize.setValue(DEFAULT_SIZE_BYTES + ""); + interval.setValue(DEFAULT_DELAY_MS + ""); + duration.setValue(DEFAULT_DURATION_MS + ""); addComponent(dataSize); addComponent(interval); @@ -114,7 +126,9 @@ public abstract class PushLargeData extends AbstractTestUIWithLog { @Override public void run() { PushLargeData ui = (PushLargeData) UI.getCurrent(); - ui.getDataLabel().setValue( + // Using description as it is not rendered to the DOM + // immediately + ui.getDataLabel().setDescription( System.currentTimeMillis() + ": " + data); ui.log("Package " + idx + " pushed"); } diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java b/uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java index 464cbcc757..7706aa90c6 100644 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java +++ b/uitest/src/com/vaadin/tests/push/PushLargeDataStreaming.java @@ -15,15 +15,19 @@ */ package com.vaadin.tests.push; +import com.vaadin.annotations.Push; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.ui.Transport; +import com.vaadin.shared.ui.ui.UIState.PushConfigurationState; +@Push(transport = Transport.STREAMING) public class PushLargeDataStreaming extends PushLargeData { @Override protected void setup(VaadinRequest request) { super.setup(request); getPushConfiguration().setTransport(Transport.STREAMING); - getPushConfiguration().setFallbackTransport(Transport.STREAMING); + getPushConfiguration().setParameter( + PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none"); } } diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java index c716a6fc7e..8f10f0fbba 100644 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java +++ b/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java @@ -19,12 +19,12 @@ import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.support.ui.ExpectedConditions; -import com.vaadin.tests.tb3.WebsocketTest; +import com.vaadin.tests.tb3.MultiBrowserTest; -public class PushLargeDataStreamingTest extends WebsocketTest { +public class PushLargeDataStreamingTest extends MultiBrowserTest { @Test - public void testWebsocketLargeData() { + public void testStreamingLargeData() { openTestURL(); // Without this there is a large chance that we will wait for all pushes @@ -39,17 +39,23 @@ public class PushLargeDataStreamingTest extends WebsocketTest { } private void push() { + // Wait for startButton to be present + waitForElementToBePresent(vaadinLocatorById("startButton")); + String logRow0Id = "Log_row_0"; By logRow0 = vaadinLocatorById(logRow0Id); vaadinElementById("startButton").click(); - waitUntil(ExpectedConditions.not(ExpectedConditions - .textToBePresentInElement(logRow0, "Push complete"))); + // Wait for push to start + waitUntil(ExpectedConditions.textToBePresentInElement(logRow0, + "Package ")); - // Pushes each 2000ms for 40s - sleep(40000); + // Wait for until push should be done + sleep(PushLargeData.DEFAULT_DURATION_MS); + // Wait until push is actually done waitUntil(ExpectedConditions.textToBePresentInElement(logRow0, "Push complete")); } + } diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java index 974dc880f9..4115a825d1 100644 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java +++ b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocket.java @@ -19,14 +19,15 @@ package com.vaadin.tests.push; import com.vaadin.annotations.Push; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.ui.Transport; +import com.vaadin.shared.ui.ui.UIState.PushConfigurationState; -@Push +@Push(transport = Transport.WEBSOCKET) public class PushLargeDataWebsocket extends PushLargeData { @Override protected void setup(VaadinRequest request) { super.setup(request); - getPushConfiguration().setTransport(Transport.WEBSOCKET); - getPushConfiguration().setFallbackTransport(Transport.WEBSOCKET); + getPushConfiguration().setParameter( + PushConfigurationState.FALLBACK_TRANSPORT_PARAM, "none"); } } diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java index 83f9efc8dd..70a94f743e 100644 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java +++ b/uitest/src/com/vaadin/tests/push/PushLargeDataWebsocketTest.java @@ -39,17 +39,21 @@ public class PushLargeDataWebsocketTest extends WebsocketTest { } private void push() { + // Wait for startButton to be present + waitForElementToBePresent(vaadinLocatorById("startButton")); + String logRow0Id = "Log_row_0"; By logRow0 = vaadinLocatorById(logRow0Id); - testBench(driver).waitForVaadin(); vaadinElementById("startButton").click(); - waitUntil(ExpectedConditions.not(ExpectedConditions - .textToBePresentInElement(logRow0, "Push complete"))); + // Wait for push to start + waitUntil(ExpectedConditions.textToBePresentInElement(logRow0, + "Package")); - // Pushes each 2000ms for 40s - sleep(40000); + // Wait for until push should be done + sleep(PushLargeData.DEFAULT_DURATION_MS); + // Wait until push is actually done waitUntil(ExpectedConditions.textToBePresentInElement(logRow0, "Push complete")); } diff --git a/uitest/src/com/vaadin/tests/push/PushReconnectTest.java b/uitest/src/com/vaadin/tests/push/PushReconnectTest.java new file mode 100644 index 0000000000..76a0b547da --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/PushReconnectTest.java @@ -0,0 +1,164 @@ +/* + * 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.tests.push; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.tests.tb3.MultiBrowserTestWithProxy; + +public abstract class PushReconnectTest extends MultiBrowserTestWithProxy { + + @Test + public void testShortDisconnect() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + disconnectProxy(); + Thread.sleep(1000); + connectProxy(); + waitUntilServerCounterChanges(); + } + + @Test + public void testUserActionWhileDisconnectedWithDelay() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + disconnectProxy(); + Assert.assertEquals(0, getClientCounter()); + getIncrementClientCounterButton().click(); + // No change while disconnected + Assert.assertEquals(0, getClientCounter()); + // Firefox sends extra onopen calls after a while, which breaks + // everything + Thread.sleep(10000); + connectProxy(); + waitUntilServerCounterChanges(); + // The change should have appeared when reconnected + Assert.assertEquals(1, getClientCounter()); + } + + @Test + public void testUserActionWhileDisconnected() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + disconnectProxy(); + Assert.assertEquals(0, getClientCounter()); + getIncrementClientCounterButton().click(); + // No change while disconnected + Assert.assertEquals(0, getClientCounter()); + Thread.sleep(1000); + connectProxy(); + waitUntilServerCounterChanges(); + // The change should have appeared when reconnected + Assert.assertEquals(1, getClientCounter()); + + // IE has problems with another reconnect + disconnectProxy(); + getIncrementClientCounterButton().click(); + Assert.assertEquals(1, getClientCounter()); + Thread.sleep(1000); + connectProxy(); + waitUntilServerCounterChanges(); + Assert.assertEquals(2, getClientCounter()); + } + + @Test + public void testLongDisconnect() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + disconnectProxy(); + Thread.sleep(12000); + connectProxy(); + waitUntilServerCounterChanges(); + } + + @Test + public void testReallyLongDisconnect() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + disconnectProxy(); + Thread.sleep(120000); + connectProxy(); + waitUntilServerCounterChanges(); + } + + @Test + public void testMultipleDisconnects() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + for (int i = 0; i < 5; i++) { + disconnectProxy(); + Thread.sleep(1000); + connectProxy(); + waitUntilServerCounterChanges(); + } + } + + @Test + public void testMultipleQuickReconnects() throws Exception { + setDebug(true); + openTestURL(); + startTimer(); + waitUntilServerCounterChanges(); + for (int i = 0; i < 50; i++) { + disconnectProxy(); + Thread.sleep(100); + connectProxy(); + Thread.sleep(100); + } + waitUntilServerCounterChanges(); + waitUntilServerCounterChanges(); + } + + private int getClientCounter() { + return BasicPushTest.getClientCounter(this); + } + + private WebElement getIncrementClientCounterButton() { + return BasicPushTest.getIncrementButton(this); + } + + private void waitUntilServerCounterChanges() { + final int counter = BasicPushTest.getServerCounter(this); + waitUntil(new ExpectedCondition<Boolean>() { + + @Override + public Boolean apply(WebDriver input) { + return BasicPushTest.getServerCounter(PushReconnectTest.this) > counter; + } + }, 30); + } + + private void startTimer() { + BasicPushTest.getServerCounterStartButton(this).click(); + } + +} diff --git a/uitest/src/com/vaadin/tests/push/StreamingReconnectTest.java b/uitest/src/com/vaadin/tests/push/StreamingReconnectTest.java new file mode 100755 index 0000000000..24dfdd8ba1 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/StreamingReconnectTest.java @@ -0,0 +1,25 @@ +/* + * 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.tests.push; + +public class StreamingReconnectTest extends PushReconnectTest { + + @Override + protected Class<?> getUIClass() { + return BasicPushStreaming.class; + } + +} diff --git a/uitest/src/com/vaadin/tests/push/WebsocketReconnectTest.java b/uitest/src/com/vaadin/tests/push/WebsocketReconnectTest.java new file mode 100644 index 0000000000..075a18c0e7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/WebsocketReconnectTest.java @@ -0,0 +1,36 @@ +/* + * 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.tests.push; + +import java.util.List; + +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.tests.tb3.WebsocketTest; + +public class WebsocketReconnectTest extends PushReconnectTest { + + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + return WebsocketTest.getWebsocketBrowsers(); + } + + @Override + protected Class<?> getUIClass() { + return BasicPushWebsocket.class; + } + +} diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index 712ef94397..d4eed99f19 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -19,7 +19,6 @@ package com.vaadin.tests.tb3; import java.net.URL; import java.util.Collections; import java.util.List; -import java.util.logging.Logger; import org.junit.After; import org.junit.Before; @@ -197,7 +196,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * * @return The port teh test is running on, by default 8888 */ - protected abstract String getDeploymentPort(); + protected abstract int getDeploymentPort(); /** * Produces a collection of browsers to run the test on. This method is @@ -306,18 +305,31 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { } /** - * Waits a short while for the given condition to become true. Use e.g. as + * Waits up to 10s for the given condition to become true. Use e.g. as * {@link #waitUntil(ExpectedConditions.textToBePresentInElement(by, text))} * * @param condition * the condition to wait for to become true */ protected void waitUntil(ExpectedCondition<Boolean> condition) { - new WebDriverWait(driver, 10).until(condition); + waitUntil(condition, 10); } /** - * Waits a short while for the given condition to become false. Use e.g. as + * Waits the given number of seconds for the given condition to become true. + * Use e.g. as {@link + * #waitUntil(ExpectedConditions.textToBePresentInElement(by, text))} + * + * @param condition + * the condition to wait for to become true + */ + protected void waitUntil(ExpectedCondition<Boolean> condition, + long timeoutInSeconds) { + new WebDriverWait(driver, timeoutInSeconds).until(condition); + } + + /** + * Waits up to 10s for the given condition to become false. Use e.g. as * {@link #waitUntilNot(ExpectedConditions.textToBePresentInElement(by, * text))} * @@ -325,7 +337,25 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { * the condition to wait for to become false */ protected void waitUntilNot(ExpectedCondition<Boolean> condition) { - new WebDriverWait(driver, 10).until(ExpectedConditions.not(condition)); + waitUntilNot(condition, 10); + } + + /** + * Waits the given number of seconds for the given condition to become + * false. Use e.g. as {@link + * #waitUntilNot(ExpectedConditions.textToBePresentInElement(by, text))} + * + * @param condition + * the condition to wait for to become false + */ + protected void waitUntilNot(ExpectedCondition<Boolean> condition, + long timeoutInSeconds) { + waitUntil(ExpectedConditions.not(condition), timeoutInSeconds); + } + + protected void waitForElementToBePresent(By by) { + waitUntil(ExpectedConditions.not(ExpectedConditions + .invisibilityOfElementLocated(by))); } /** @@ -476,14 +506,6 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { } } catch (Exception e) { } - Class<?> enclosingClass = getClass().getEnclosingClass(); - if (enclosingClass != null) { - if (UI.class.isAssignableFrom(enclosingClass)) { - Logger.getLogger(getClass().getName()) - .severe("Test is an static inner class to the UI. This will no longer be supported in the future. The test should be named UIClassTest and reside in the same package as the UI"); - return enclosingClass; - } - } throw new RuntimeException( "Could not determine UI class. Ensure the test is named UIClassTest and is in the same package as the UIClass"); } @@ -645,6 +667,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { */ public static DesiredCapabilities safari(int version) { DesiredCapabilities c = DesiredCapabilities.safari(); + c.setPlatform(Platform.MAC); c.setVersion("" + version); return c; } diff --git a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java index 040d0156a3..e8a974343b 100644 --- a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java +++ b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java @@ -40,7 +40,7 @@ import org.openqa.selenium.remote.DesiredCapabilities; */ public abstract class MultiBrowserTest extends PrivateTB3Configuration { - public static final int TESTED_SAFARI_VERSION = 6; + public static final int TESTED_SAFARI_VERSION = 7; public static final int TESTED_CHROME_VERSION = 29; public static final int TESTED_FIREFOX_VERSION = 24; @@ -52,7 +52,7 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration { allBrowsers.add(BrowserUtil.ie(11)); allBrowsers.add(BrowserUtil.firefox(TESTED_FIREFOX_VERSION)); // Uncomment once we have the capability to run on Safari 6 - // allBrowsers.add(safari(TESTED_SAFARI_VERSION)); + // allBrowsers.add(BrowserUtil.safari(TESTED_SAFARI_VERSION)); allBrowsers.add(BrowserUtil.chrome(TESTED_CHROME_VERSION)); // Re-enable this when it is possible to run on a modern Opera version // (15+) diff --git a/uitest/src/com/vaadin/tests/tb3/MultiBrowserTestWithProxy.java b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTestWithProxy.java new file mode 100755 index 0000000000..0bb76889a0 --- /dev/null +++ b/uitest/src/com/vaadin/tests/tb3/MultiBrowserTestWithProxy.java @@ -0,0 +1,106 @@ +/* + * 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.tests.tb3; + +import java.io.File; +import java.util.concurrent.atomic.AtomicInteger; + +import org.junit.After; +import org.junit.Before; + +import com.jcraft.jsch.JSch; +import com.jcraft.jsch.JSchException; +import com.jcraft.jsch.Session; + +public abstract class MultiBrowserTestWithProxy extends MultiBrowserTest { + + private static AtomicInteger availablePort = new AtomicInteger(2000); + private Session proxySession; + private Integer proxyPort = null; + private JSch jsch; + private static String sshDir = System.getProperty("user.home") + "/.ssh/"; + private String[] publicKeys = new String[] { + System.getProperty("sshkey.file"), sshDir + "id_rsa", + sshDir + "id_dsa", sshDir + "id_rsa2" }; + + @Before + public void setupInitialProxy() throws JSchException { + connectProxy(); + } + + @After + public void teardownProxy() { + disconnectProxy(); + } + + protected Integer getProxyPort() { + if (proxyPort == null) { + // Assumes we can use any port >= 2000 + proxyPort = availablePort.addAndGet(1); + } + return proxyPort; + } + + /** + * Disconnects the proxy if active + */ + protected void disconnectProxy() { + if (proxySession == null) { + return; + } + proxySession.disconnect(); + proxySession = null; + } + + /** + * Ensure the proxy is active. Does nothing if the proxy is already active. + */ + protected void connectProxy() throws JSchException { + if (proxySession != null) { + return; + } + + createProxy(getProxyPort()); + } + + private void createProxy(int proxyPort) throws JSchException { + if (jsch == null) { + jsch = new JSch(); + + String keyFile = null; + for (String publicKey : publicKeys) { + if (publicKey != null) { + if (new File(publicKey).exists()) { + keyFile = publicKey; + break; + } + } + } + jsch.addIdentity(keyFile); + } + proxySession = jsch.getSession("localhost"); + proxySession.setConfig("StrictHostKeyChecking", "no"); + proxySession.setPortForwardingL("0.0.0.0", proxyPort, + super.getDeploymentHostname(), super.getDeploymentPort()); + proxySession.connect(); + } + + @Override + protected String getBaseURL() { + return "http://" + getDeploymentHostname() + ":" + getProxyPort(); + } + +} diff --git a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java index a2922af28f..caa35732d6 100644 --- a/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java +++ b/uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java @@ -90,11 +90,12 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { } @Override - protected String getDeploymentPort() { - String port = getProperty(PORT_PROPERTY); + protected int getDeploymentPort() { + String portString = getProperty(PORT_PROPERTY); - if (port == null || "".equals(port)) { - port = "8888"; + int port = 8888; + if (portString != null && !"".equals(portString)) { + port = Integer.parseInt(portString); } return port; diff --git a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java index cbdae1a6c1..a51421d3d5 100644 --- a/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/ScreenshotTB3Test.java @@ -31,7 +31,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.rules.TestRule; import org.junit.rules.TestWatcher; -import org.junit.runner.Description; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.remote.DesiredCapabilities; @@ -62,18 +61,7 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { String className = testClass.getSimpleName(); screenshotBaseName = className + "-" + testMethod; - } - - @Override - protected void failed(Throwable e, Description description) { - - // Notify Teamcity of failed test - if (!System.getProperty("teamcity.version", "").equals("")) { - System.out.print("##teamcity[publishArtifacts '"); - System.out.println(getScreenshotErrorBaseName() - + "* => screenshot-errors']"); - } - } + }; }; /** @@ -129,9 +117,28 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { // Matched one comparison but not all, remove all error images + // HTML files } else { - // All comparisons failed, keep the main error image + HTML - screenshotFailures.add(mainReference.getName()); - referenceToKeep = mainReference; + // Ensure we use the correct browser version (e.g. if running IE11 + // and only an IE 10 reference was available, then mainReference + // will be for IE 10, not 11) + String originalName = getScreenshotReferenceName(identifier); + File exactVersionFile = new File(originalName); + + if (!exactVersionFile.equals(mainReference)) { + // Rename png+html to have the correct version + File correctPng = getErrorFileFromReference(exactVersionFile); + File producedPng = getErrorFileFromReference(mainReference); + File correctHtml = htmlFromPng(correctPng); + File producedHtml = htmlFromPng(producedPng); + + producedPng.renameTo(correctPng); + producedHtml.renameTo(correctHtml); + referenceToKeep = exactVersionFile; + screenshotFailures.add(exactVersionFile.getName()); + } else { + // All comparisons failed, keep the main error image + HTML + screenshotFailures.add(mainReference.getName()); + referenceToKeep = mainReference; + } } // Remove all PNG/HTML files we no longer need (failed alternative @@ -140,10 +147,7 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { File failurePng = getErrorFileFromReference(failedAlternative); if (failedAlternative != referenceToKeep) { // Delete png + HTML - String htmlFileName = failurePng.getName().replace(".png", - ".html"); - File failureHtml = new File(failurePng.getParentFile(), - htmlFileName); + File failureHtml = htmlFromPng(failurePng); failurePng.delete(); failureHtml.delete(); @@ -152,6 +156,18 @@ public abstract class ScreenshotTB3Test extends AbstractTB3Test { } /** + * Returns a new File which points to a .html file instead of the given .png + * file + * + * @param png + * @return + */ + private static File htmlFromPng(File png) { + return new File(png.getParentFile(), png.getName().replaceAll( + "\\.png$", ".png.html")); + } + + /** * * @param referenceFile * The reference image file (in the directory defined by diff --git a/uitest/tb3test.xml b/uitest/tb3test.xml index 5285280608..dd0c12db91 100644 --- a/uitest/tb3test.xml +++ b/uitest/tb3test.xml @@ -19,21 +19,12 @@ <target name="run-tb3-suite"> <fail unless="junit.test.suite" message="Define suite to run using junit.test.suite" /> <fail unless="com.vaadin.testbench.screenshot.directory" message="Define screenshot directory using -Dcom.vaadin.testbench.screenshot.directory" /> - - <!-- Ensure teamcity.version is set to something --> - <condition property="teamcity.version" value=""> - <not> - <isset property="teamcity.version" /> - </not> - </condition> - <junit printsummary="withOutAndErr" fork="yes"> <formatter usefile="false" type="plain" /> <classpath refid="classpath.tb3" /> <jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" /> <jvmarg value="-Djava.awt.headless=true" /> - <jvmarg value="-Dteamcity.version=${teamcity.version}" /> <test name="${junit.test.suite}" /> </junit> diff --git a/uitest/test.xml b/uitest/test.xml index 3bfeb66c05..b0db8d47f4 100644 --- a/uitest/test.xml +++ b/uitest/test.xml @@ -134,18 +134,8 @@ </batchtest> </junit> - <antcall target="notify-teamcity-of-build-artifact"> - <param name="file" value="${target}" /> - </antcall> - </target> - <!-- Have teamcity publish each test error artifact immediatly if there are any --> - <target name="notify-teamcity-of-build-artifact" if="teamcity.version"> - <basename property="basename" file="${file}" suffix="java" /> - <echo>##teamcity[publishArtifacts '${com.vaadin.testbench.screenshot.directory}/errors/${basename}* => screenshot-errors']</echo> - </target> - <!-- Remove temporary source and compiled java files --> <target name="remove-temp-testclasses"> <delete failonerror="false"> diff --git a/uitest/vaadin-server.xml b/uitest/vaadin-server.xml index 4e84a6f238..5e9090a536 100644 --- a/uitest/vaadin-server.xml +++ b/uitest/vaadin-server.xml @@ -8,7 +8,7 @@ <ivy:resolve log="download-only" file="${dir}/ivy.xml" /> <ivy:cachepath pathid="classpath.jetty" conf="jetty-run" /> - <java classname="org.mortbay.jetty.runner.Runner" fork="yes" output="${vaadin.basedir}/result/jetty.java.out" resultproperty="resultCode"> + <java classname="org.mortbay.jetty.runner.Runner" fork="yes" output="${vaadin.basedir}/result/jetty.java.out" resultproperty="resultCode" maxmemory="1024m"> <arg value="--port" /> <arg value="8888" /> <arg value="--out" /> |