diff options
author | Leif Åstrand <leif@vaadin.com> | 2011-09-06 13:37:35 +0000 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2011-09-06 13:37:35 +0000 |
commit | 5e290d26f69557fec1200e8d69e22beba88b0dd2 (patch) | |
tree | b9fa82d9a713e7c8f5a853dc77f16526bfdf7a66 /tests | |
parent | 2fb3b5581b55dfff407cc86afabadf8aea440b7c (diff) | |
download | vaadin-framework-5e290d26f69557fec1200e8d69e22beba88b0dd2.tar.gz vaadin-framework-5e290d26f69557fec1200e8d69e22beba88b0dd2.zip |
#5868 GridLayout's size is calculated wrong when elements span over multiple cells
svn changeset:20888/svn branch:6.7
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.html | 26 | ||||
-rw-r--r-- | tests/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.java | 67 |
2 files changed, 93 insertions, 0 deletions
diff --git a/tests/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.html b/tests/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.html new file mode 100644 index 0000000000..5237d5f49e --- /dev/null +++ b/tests/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.html @@ -0,0 +1,26 @@ +<?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>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.layouts.GridLayoutSpanExpansion?restartApplication</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> +</tbody></table> +</body> +</html> diff --git a/tests/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.java b/tests/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.java new file mode 100644 index 0000000000..9753526a9e --- /dev/null +++ b/tests/src/com/vaadin/tests/layouts/GridLayoutSpanExpansion.java @@ -0,0 +1,67 @@ +package com.vaadin.tests.layouts; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Label; + +public class GridLayoutSpanExpansion extends TestBase { + + @Override + protected void setup() { + GridLayout heightSpan = new GridLayout(2, 2); + heightSpan.setHeight("200px"); + heightSpan.setWidth("200px"); + heightSpan.addComponent(new Label("1"), 0, 0); + heightSpan.addComponent(new Label("2"), 0, 1); + heightSpan.addComponent(new Label( + "This is a somewhat long text that spans over a few lines."), + 1, 0, 1, 1); + heightSpan.setRowExpandRatio(1, 1); + addComponent(heightSpan); + + GridLayout widthSpan = new GridLayout(2, 2); + widthSpan.setHeight("100px"); + widthSpan.setWidth("200px"); + widthSpan.addComponent(new Label( + "This is a somewhat long text that spans over both columns."), + 0, 0, 1, 0); + Label label1 = new Label("1"); + label1.setSizeUndefined(); + widthSpan.addComponent(label1, 0, 1); + widthSpan.addComponent(new Label("2"), 1, 1); + widthSpan.setColumnExpandRatio(1, 1); + addComponent(widthSpan); + + GridLayout multipleSpans = new GridLayout(3, 3); + multipleSpans.setWidth("400px"); + multipleSpans.addComponent(new Button("Button 0,0"), 0, 0); + multipleSpans.addComponent(new Button("Button 1,0"), 1, 0); + multipleSpans.addComponent( + makeWideButton("A wide spanning button at 0,1"), 0, 1, 1, 1); + multipleSpans.addComponent( + makeWideButton("Another wide spanning button at 1,2"), 1, 2, 2, + 2); + multipleSpans.setColumnExpandRatio(0, 1); + multipleSpans.setColumnExpandRatio(1, 3); + multipleSpans.setColumnExpandRatio(2, 2); + addComponent(multipleSpans); + } + + private static Button makeWideButton(String caption) { + Button wideButton = new Button(caption); + wideButton.setWidth("100%"); + return wideButton; + } + + @Override + protected String getDescription() { + return "In the two first examples, the 1 and the 2 should be close to each other because of the expansion ratios. In the final example, there should be little extra space in the left column, much extra space in the middle and some extra space to the right"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(5868); + } + +} |