Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

HorizontalScrollAfterResizeTest.java 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package com.vaadin.tests.components.grid;
  2. import static org.junit.Assert.assertEquals;
  3. import static org.junit.Assert.assertTrue;
  4. import org.junit.Test;
  5. import org.openqa.selenium.Dimension;
  6. import org.openqa.selenium.Point;
  7. import com.vaadin.testbench.elements.GridElement;
  8. import com.vaadin.v7.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
  9. /**
  10. * @author Vaadin Ltd
  11. *
  12. */
  13. public class HorizontalScrollAfterResizeTest extends GridBasicFeaturesTest {
  14. /**
  15. * The behavior without the fix differs across different browsers but
  16. * scenario should work everywhere.
  17. */
  18. @Test
  19. public void scrollAfterResize() {
  20. getDriver().manage().window().setSize(new Dimension(600, 400));
  21. openTestURL();
  22. getDriver().manage().window().setSize(new Dimension(200, 400));
  23. // First scroll to the right
  24. scrollGridHorizontallyTo(600);
  25. Point locationAfterFirstScroll = $(GridElement.class).first()
  26. .getCell(0, 9).getLocation();
  27. // resize back
  28. getDriver().manage().window().setSize(new Dimension(600, 400));
  29. // shrink again
  30. getDriver().manage().window().setSize(new Dimension(200, 400));
  31. // second scroll to the right
  32. scrollGridHorizontallyTo(600);
  33. Point locationAfterSecondScrollcation = $(GridElement.class).first()
  34. .getCell(0, 9).getLocation();
  35. // With the bug scrolling doesn't happen. Location should be around of
  36. // the initial scrolling
  37. assertEquals(locationAfterFirstScroll.getY(),
  38. locationAfterSecondScrollcation.getY());
  39. int delta = 5;
  40. assertTrue(Math.abs(locationAfterFirstScroll.getX()
  41. - locationAfterSecondScrollcation.getX()) < delta);
  42. }
  43. @Override
  44. protected Class<?> getUIClass() {
  45. return HorizontalScrollAfterResize.class;
  46. }
  47. }