diff options
Diffstat (limited to 'uitest/src/com/vaadin/tests')
6 files changed, 193 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/serialization/GenericWidgetHandling.java b/uitest/src/com/vaadin/tests/serialization/GenericWidgetHandling.java new file mode 100644 index 0000000000..dca96a46ea --- /dev/null +++ b/uitest/src/com/vaadin/tests/serialization/GenericWidgetHandling.java @@ -0,0 +1,46 @@ +/* + * 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.serialization; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.widgetset.TestingWidgetSet; +import com.vaadin.tests.widgetset.server.GenericWidgetComponent; + +@Widgetset(TestingWidgetSet.NAME) +public class GenericWidgetHandling extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final GenericWidgetComponent component = new GenericWidgetComponent(); + component.setId("label"); + component.setGenericText("The generic text is strong in this one"); + addComponent(component); + } + + @Override + protected String getTestDescription() { + return "Tests that a connector works even if its widget is of a generic type"; + } + + @Override + protected Integer getTicketNumber() { + // Also 12900 if someone happens to care + return Integer.valueOf(12873); + } + +} diff --git a/uitest/src/com/vaadin/tests/serialization/GenericWidgetHandlingTest.java b/uitest/src/com/vaadin/tests/serialization/GenericWidgetHandlingTest.java new file mode 100644 index 0000000000..a6ff0c4459 --- /dev/null +++ b/uitest/src/com/vaadin/tests/serialization/GenericWidgetHandlingTest.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.tests.serialization; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class GenericWidgetHandlingTest extends MultiBrowserTest { + + @Test + public void testWidgetInit() { + openTestURL(); + WebElement label = vaadinElementById("label"); + + Assert.assertEquals("The generic text is strong in this one", + label.getText()); + } + +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/GenericWidget.java b/uitest/src/com/vaadin/tests/widgetset/client/GenericWidget.java new file mode 100644 index 0000000000..bf191d1e87 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/GenericWidget.java @@ -0,0 +1,24 @@ +/* + * 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.widgetset.client; + +import com.google.gwt.user.client.ui.Label; + +public class GenericWidget<T> extends Label { + public void setGenericText(T value) { + setText(String.valueOf(value)); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/GenericWidgetConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/GenericWidgetConnector.java new file mode 100644 index 0000000000..a05bedfa27 --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/GenericWidgetConnector.java @@ -0,0 +1,33 @@ +/* + * 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.widgetset.client; + +import com.vaadin.client.ui.AbstractComponentConnector; +import com.vaadin.shared.ui.Connect; +import com.vaadin.tests.widgetset.server.GenericWidgetComponent; + +@Connect(GenericWidgetComponent.class) +public class GenericWidgetConnector extends AbstractComponentConnector { + @Override + public GenericWidget<String> getWidget() { + return (GenericWidget<String>) super.getWidget(); + } + + @Override + public GenericWidgetState getState() { + return (GenericWidgetState) super.getState(); + } +} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/GenericWidgetState.java b/uitest/src/com/vaadin/tests/widgetset/client/GenericWidgetState.java new file mode 100644 index 0000000000..79dce8de9f --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/client/GenericWidgetState.java @@ -0,0 +1,24 @@ +/* + * 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.widgetset.client; + +import com.vaadin.shared.AbstractComponentState; +import com.vaadin.shared.annotations.DelegateToWidget; + +public class GenericWidgetState extends AbstractComponentState { + @DelegateToWidget + public String genericText; +} diff --git a/uitest/src/com/vaadin/tests/widgetset/server/GenericWidgetComponent.java b/uitest/src/com/vaadin/tests/widgetset/server/GenericWidgetComponent.java new file mode 100644 index 0000000000..2be59ee96b --- /dev/null +++ b/uitest/src/com/vaadin/tests/widgetset/server/GenericWidgetComponent.java @@ -0,0 +1,31 @@ +/* + * 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.widgetset.server; + +import com.vaadin.tests.widgetset.client.GenericWidgetState; +import com.vaadin.ui.AbstractComponent; + +public class GenericWidgetComponent extends AbstractComponent { + + @Override + protected GenericWidgetState getState() { + return (GenericWidgetState) super.getState(); + } + + public void setGenericText(String genericText) { + getState().genericText = genericText; + } +} |