You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ImageDeclarativeTest.java 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package com.vaadin.tests.server.component.image;
  2. import org.junit.Test;
  3. import com.vaadin.server.ExternalResource;
  4. import com.vaadin.tests.design.DeclarativeTestBase;
  5. import com.vaadin.ui.Image;
  6. /**
  7. * Tests declarative support for implementations of {@link Image}.
  8. *
  9. * @author Vaadin Ltd
  10. */
  11. public class ImageDeclarativeTest extends DeclarativeTestBase<Image> {
  12. protected String getDesign() {
  13. return "<vaadin-image source='http://foo.bar/img.png' alt='Some random image from the theme'></vaadin-image>";
  14. }
  15. protected Image getExpectedResult() {
  16. Image i = new Image();
  17. i.setSource(new ExternalResource("http://foo.bar/img.png"));
  18. i.setAlternateText("Some random image from the theme");
  19. return i;
  20. };
  21. @Test
  22. public void read() {
  23. testRead(getDesign(), getExpectedResult());
  24. }
  25. @Test
  26. public void write() {
  27. testWrite(getDesign(), getExpectedResult());
  28. }
  29. @Test
  30. public void testEmpty() {
  31. testRead("<vaadin-image />", new Image());
  32. }
  33. }