選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

GridUndefinedHeightTest.java 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package com.vaadin.tests.components.grid;
  2. import static org.junit.Assert.assertEquals;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. import com.vaadin.testbench.elements.ButtonElement;
  6. import com.vaadin.testbench.elements.GridElement;
  7. import com.vaadin.testbench.parallel.TestCategory;
  8. import com.vaadin.tests.tb3.SingleBrowserTest;
  9. @TestCategory("grid")
  10. public class GridUndefinedHeightTest extends SingleBrowserTest {
  11. @Before
  12. public void before() {
  13. setDebug(true);
  14. openTestURL();
  15. }
  16. @Test
  17. public void grid_undefined_height() {
  18. GridElement grid = $(GridElement.class).first();
  19. int oneRow = grid.getRow(0).getSize().getHeight();
  20. int gridHeight = grid.getSize().getHeight();
  21. int rows = 4; // Header Row + 3 Body Rows
  22. assertEquals("Grid height mismatch", oneRow * rows, gridHeight);
  23. assertNoErrorNotifications();
  24. }
  25. @Test
  26. public void gridv7_undefined_height() {
  27. GridElement grid = $(GridElement.class).get(1);
  28. int oneRow = grid.getRow(0).getSize().getHeight();
  29. int gridHeight = grid.getSize().getHeight();
  30. int rows = 4; // Header Row + 3 Body Rows
  31. assertEquals("Grid height mismatch", oneRow * rows, gridHeight);
  32. assertNoErrorNotifications();
  33. }
  34. @Test
  35. public void grid_undefined_height_add_header() {
  36. // Add header row to Grid
  37. $(ButtonElement.class).first().click();
  38. GridElement grid = $(GridElement.class).first();
  39. int oneRow = grid.getRow(0).getSize().getHeight();
  40. int gridHeight = grid.getSize().getHeight();
  41. int rows = 5; // 2 Header Rows + 3 Body Rows
  42. assertEquals("Grid height mismatch", oneRow * rows, gridHeight);
  43. assertNoErrorNotifications();
  44. }
  45. @Test
  46. public void gridv7_undefined_height_add_header() {
  47. // Add header row to Grid
  48. $(ButtonElement.class).first().click();
  49. GridElement grid = $(GridElement.class).get(1);
  50. int oneRow = grid.getRow(0).getSize().getHeight();
  51. int gridHeight = grid.getSize().getHeight();
  52. int rows = 5; // 2 Header Rows + 3 Body Rows
  53. assertEquals("Grid height mismatch", oneRow * rows, gridHeight);
  54. assertNoErrorNotifications();
  55. }
  56. }