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.

ValoDefaultCaptionWidthTest.java 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.themes.valo;
  17. import static org.hamcrest.Matchers.greaterThan;
  18. import static org.hamcrest.Matchers.is;
  19. import static org.hamcrest.Matchers.lessThan;
  20. import static org.junit.Assert.assertThat;
  21. import org.junit.Test;
  22. import com.vaadin.testbench.elements.ColorPickerElement;
  23. import com.vaadin.tests.components.colorpicker.DefaultCaptionWidthTest;
  24. /**
  25. * Test for default caption behavior in color picker using Valo theme.
  26. *
  27. * @author Vaadin Ltd
  28. */
  29. public class ValoDefaultCaptionWidthTest extends DefaultCaptionWidthTest {
  30. @Override
  31. @Test
  32. public void setDefaultCaption_sizeAndCaptionAreNotSet_pickerGetsStyle() {
  33. super.setDefaultCaption_sizeAndCaptionAreNotSet_pickerGetsStyle();
  34. int width = $(ColorPickerElement.class).first().getSize().getWidth();
  35. // Make sure that implicit width is less than one that will be
  36. // explicitly set by the test
  37. assertThat("Width of color picker is overriden by "
  38. + "default caption feature", width, is(lessThan(148)));
  39. }
  40. @Override
  41. @Test
  42. public void setDefaultCaption_explicitSizeIsSet_pickerNoCaptionStyle() {
  43. super.setDefaultCaption_explicitSizeIsSet_pickerNoCaptionStyle();
  44. int width = $(ColorPickerElement.class).first().getSize().getWidth();
  45. // Width should be 150px but let's just check that it's not which is
  46. // used when default caption is used and at least >= 150-1
  47. assertThat(
  48. "Width of color picker is overriden by "
  49. + "default caption feature",
  50. width, is(greaterThan(149)));
  51. }
  52. }