You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by jw...@apache.org on 2009/03/11 01:19:55 UTC

svn commit: r752315 - in /myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src: main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ test/java/org/apache/myfaces/trinidadinternal/renderkit/ test/resources/org/apache/myfaces/trinid...

Author: jwaldman
Date: Wed Mar 11 00:19:55 2009
New Revision: 752315

URL: http://svn.apache.org/viewvc?rev=752315&view=rev
Log:
TRINIDAD-1419 Trinidad chooseDate golden files break with daylight savings
thanks to Yee-Wah Lee. 1.2.11.1-branch

Modified:
    myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ChooseDateRenderer.java
    myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MVariableResolver.java
    myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/chooseDate.xml

Modified: myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ChooseDateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ChooseDateRenderer.java?rev=752315&r1=752314&r2=752315&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ChooseDateRenderer.java (original)
+++ myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ChooseDateRenderer.java Wed Mar 11 00:19:55 2009
@@ -75,6 +75,7 @@
     _maxValueKey = type.findKey("maxValue");
     _minValueKey = type.findKey("minValue");
     _valueKey = PropertyKey.createPropertyKey("value");
+    _currTimeKey = PropertyKey.createPropertyKey("currTime");
     _scrolledValueKey = PropertyKey.createPropertyKey("scrolledValue");
     _destinationKey = PropertyKey.createPropertyKey("destination");
   }
@@ -122,7 +123,17 @@
     // the application timezone, the offset value may be different. In that case
     // pass the new offset value for the client to use. 
     TimeZone tz = arc.getLocaleContext().getTimeZone();
-    int baseTZOffsetMinutes = tz.getOffset(System.currentTimeMillis())/(1000*60);
+    
+    // TRINIDAD-1419: chooseDate golden files should stay the same even if
+    // the server runs in different timezones. 
+    long currTimeMillis = 0;
+    Object currTimeValue =  bean.getProperty (_currTimeKey);
+    if (currTimeValue != null)
+      currTimeMillis = ((Date) currTimeValue).getTime();
+    else
+      currTimeMillis = System.currentTimeMillis();
+    
+    int baseTZOffsetMinutes = tz.getOffset(currTimeMillis/(1000*60));
 
     boolean isDesktop = isDesktop(arc);
     ResponseWriter writer = context.getResponseWriter();
@@ -1588,6 +1599,7 @@
   private PropertyKey _maxValueKey;
   private PropertyKey _minValueKey;
   private PropertyKey _valueKey;
+  private PropertyKey _currTimeKey;
   private PropertyKey _scrolledValueKey;
   private PropertyKey _destinationKey;
 

Modified: myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MVariableResolver.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MVariableResolver.java?rev=752315&r1=752314&r2=752315&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MVariableResolver.java (original)
+++ myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MVariableResolver.java Wed Mar 11 00:19:55 2009
@@ -234,6 +234,10 @@
       // FIXME: Should be able to use Calendar for non deprecated calls.
       return new Date(130, 0, 5);
     }
+    else if ("currTime".equals(name))
+    {
+      return new Date(109,0,1);
+    }
     else if("simpleDocument".equals(name))
     {
       return "First paragraph followed by \\r\r" + 

Modified: myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/chooseDate.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/chooseDate.xml?rev=752315&r1=752314&r2=752315&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/chooseDate.xml (original)
+++ myfaces/trinidad/branches/1.2.11.1-branch/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/chooseDate.xml Wed Mar 11 00:19:55 2009
@@ -3,6 +3,7 @@
        agentNotSupported="pda">
  <base-component tr:type="org.apache.myfaces.trinidad.CoreChooseDate"
      value="#{midDate}" minValue="#{oldDate}" maxValue="#{newDate}"
+     currTime="#{currTime}" 
      scrolledValue="#{null}"/>
   <attribute-test name="id" value="dateid"/>
   <attribute-test name="inlineStyle"/>