aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-10-24 08:57:43 +0000
committerVaadin Code Review <review@vaadin.com>2012-10-24 08:57:43 +0000
commitde4669b0d88a124398fc6a472b9a4dee385d56b6 (patch)
tree418d4291ce995b486d3cd871883af1470bfbcb08 /uitest/src
parent73a199d19d730a110689d8a5bb30e2a9f068ff9a (diff)
parent41f130d65e7d6d12d670ab3f64b6d69af18aa3ca (diff)
downloadvaadin-framework-de4669b0d88a124398fc6a472b9a4dee385d56b6.tar.gz
vaadin-framework-de4669b0d88a124398fc6a472b9a4dee385d56b6.zip
Merge "Made test understandable and ensure it passes by using timestamps"
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/com/vaadin/tests/components/image/ImageClicks.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/uitest/src/com/vaadin/tests/components/image/ImageClicks.java b/uitest/src/com/vaadin/tests/components/image/ImageClicks.java
index e50b8c3a4f..397e31c39c 100644
--- a/uitest/src/com/vaadin/tests/components/image/ImageClicks.java
+++ b/uitest/src/com/vaadin/tests/components/image/ImageClicks.java
@@ -7,7 +7,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Random;
+import java.util.Date;
import javax.imageio.ImageIO;
@@ -20,8 +20,6 @@ import com.vaadin.ui.Label;
public class ImageClicks extends TestBase {
- private final Random rng = new Random(0);
-
private int clickCounter = 0;
@Override
@@ -30,7 +28,7 @@ public class ImageClicks extends TestBase {
final Label label = new Label(labelText());
addComponent(label);
- Image image = new Image();
+ final Image image = new Image();
final MyImageSource imageSource = new MyImageSource();
final StreamResource imageResource = new StreamResource(imageSource,
"testimage.png");
@@ -40,6 +38,9 @@ public class ImageClicks extends TestBase {
@Override
public void click(ClickEvent event) {
++clickCounter;
+ imageResource.setFilename("testimage.png?"
+ + new Date().getTime());
+ image.markAsDirty();
label.setValue(labelText());
}
@@ -58,7 +59,7 @@ public class ImageClicks extends TestBase {
@Override
protected String getDescription() {
- return "Test click event handling of images";
+ return "Each click on the dynamically generated image should update the image and add another black square";
}
@Override
@@ -110,11 +111,13 @@ public class ImageClicks extends TestBase {
}
// Cell
- if (rng.nextFloat() < 0.5f) {
- drawable.setColor(Color.white);
- } else {
+ int cellIndex = col + row * cols;
+ if (clickCounter > cellIndex) {
drawable.setColor(Color.black);
+ } else {
+ drawable.setColor(Color.white);
}
+
drawable.fillRect(gridx + 1, gridy + 1, gridxnext - gridx
- 1, gridynext - gridy - 1);
}