Author: dsvyatobatsko
Date: 2009-01-05 13:35:29 -0500 (Mon, 05 Jan 2009)
New Revision: 12118
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/layoutTests.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java
Log:
cell height/width attributes test fixed
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/layoutTests.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java 2009-01-05
18:26:11 UTC (rev 12117)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java 2009-01-05
18:35:29 UTC (rev 12118)
@@ -1624,8 +1624,10 @@
@Test
public void testInputSizeAttribute(Template template) {
renderPage(LAYOUT_TESTS_URL, template, null);
- initIds(getParentId());
+ inputDateId = getParentId() + "form:calendarInputDate";
+ showPopupId = getParentId() + "form:showPopup";
+
writeStatus("Check 'inputSize' attribute");
check(showPopupId, true);
@@ -1636,10 +1638,17 @@
@Test
public void testCellWidthAndCellHeightAttributes(Template template) {
renderPage(LAYOUT_TESTS_URL, template, null);
- initIds(getParentId());
+ //In IE 6 the class selector doesn’t work if the class name starts with an
underscore or a hyphen
+ //I was reluctant to rename form name
+ calendarId = getParentId() + "form:calendar";
+ showPopupId = getParentId() + "form:showPopup";
+ popupButtonId = calendarId + "PopupButton";
+ String dayCell5 = calendarId + "DayCell5";
+
int expectedCellWidth = 31;
int expectedCellHeight = 33;
+ int precision = 1;
writeStatus("Check 'cellWidth' and 'cellHeight'
attributes.");
@@ -1647,15 +1656,22 @@
check(showPopupId, false);
writeStatus("Check size of arbitrary cell. Width must be 31px, height must
be 33px");
- Assert.assertEquals(selenium.getElementHeight(calendarId +
"DayCell5").intValue(), expectedCellHeight);
- Assert.assertEquals(selenium.getElementWidth(calendarId +
"DayCell5").intValue(), expectedCellWidth);
+ int height = selenium.getElementHeight(dayCell5).intValue();
+ int width = selenium.getElementWidth(dayCell5).intValue();
+
+ Assert.assertTrue((Math.abs(height - expectedCellHeight) <= precision), height
+ "==" + expectedCellHeight);
+ Assert.assertTrue((Math.abs(width - expectedCellWidth) <= precision), width +
"==" + expectedCellWidth);
+
writeStatus("Check the same for popup mode");
check(showPopupId, true);
showPopup();
- Assert.assertEquals(selenium.getElementHeight(calendarId +
"DayCell5").intValue(), expectedCellHeight);
- Assert.assertEquals(selenium.getElementWidth(calendarId +
"DayCell5").intValue(), expectedCellWidth);
+ height = selenium.getElementHeight(dayCell5).intValue();
+ width = selenium.getElementWidth(dayCell5).intValue();
+
+ Assert.assertTrue((Math.abs(height - expectedCellHeight) <= precision), height
+ "==" + expectedCellHeight);
+ Assert.assertTrue((Math.abs(width - expectedCellWidth) <= precision), width +
"==" + expectedCellWidth);
}
@Test
@@ -1841,6 +1857,12 @@
clickById(popupButtonId);
}
+ private void showPopupAndWait() {
+ writeStatus("Show popup");
+ clickById(popupButtonId);
+ waiteForCondition("$('" + calendarId + "').style.display
!= 'none'", 1000);
+ }
+
/**
* Test an icon.
*
Show replies by date