diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-12-15 09:19:08 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-12-15 09:19:08 +0000 |
commit | 68c2ac1150f35124440a35a396684bf6c1b49f23 (patch) | |
tree | 7652b8504d0ba2685a9406dca9a1fe131c2fda72 /tests | |
parent | d4c526b2ef29faa1f05b686e31f717dc5d8a8148 (diff) | |
download | vaadin-framework-68c2ac1150f35124440a35a396684bf6c1b49f23.tar.gz vaadin-framework-68c2ac1150f35124440a35a396684bf6c1b49f23.zip |
Test case and fix for #3817 - Upload: Browsers send different filenames
svn changeset:10305/svn branch:6.2
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/vaadin/tests/components/upload/TestUploadFilename.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/src/com/vaadin/tests/components/upload/TestUploadFilename.java b/tests/src/com/vaadin/tests/components/upload/TestUploadFilename.java new file mode 100644 index 0000000000..12006412f2 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/upload/TestUploadFilename.java @@ -0,0 +1,61 @@ +package com.vaadin.tests.components.upload; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Label; +import com.vaadin.ui.Upload; +import com.vaadin.ui.Upload.FinishedEvent; +import com.vaadin.ui.Upload.Receiver; + +public class TestUploadFilename extends TestBase { + + private Label result = new Label("Waiting for upload"); + private UploadReceiver receiver = new UploadReceiver(); + + @Override + protected void setup() { + + Upload upload = new Upload("Upload a file", receiver); + + addComponent(upload); + addComponent(result); + + upload.addListener(new Upload.FinishedListener() { + public void uploadFinished(FinishedEvent event) { + result.setValue("Got file (should not contain path): " + + receiver.getFilename()); + } + }); + + } + + public static class UploadReceiver implements Receiver { + + private String filename; + + public OutputStream receiveUpload(String filename, String MIMEType) { + this.filename = filename; + return new ByteArrayOutputStream(); + } + + public String getFilename() { + return filename; + } + + } + + @Override + protected String getDescription() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + +} |