Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.jdesktop.swingx.JXMonthViewTest fails when run on last day of a month #15

Open
homebeaver opened this issue Dec 1, 2021 · 1 comment

Comments

@homebeaver
Copy link
Owner

testTimeZoneChangeOffsetFirstDisplayedDate

    @Test
    public void testTimeZoneChangeOffsetFirstDisplayedDate() {
...
        assertEquals("first displayed must be offset by real offset", 
                realOffset,  monthView.getFirstDisplayedDay().getTime() - firstDisplayed.getTime());

siehe https://github.com/homebeaver/SwingSet3/actions/runs/1522343606

Error: Failures:
Error: JXMonthViewTest.testTimeZoneChangeOffsetFirstDisplayedDate:2126 first displayed must be offset by real offset expected:<-10800000> but was:<2581200000>
Error: JXMonthViewTest.testTimeZoneChangeToday:2042 first displayed must be offset by real offset
********** spurious failure - so try extensiv debug output:
server locale: en
server timezone: sun.util.calendar.ZoneInfo[id="Etc/UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
server local time: Tue Nov 30 18:29:35 UTC 2021
first timeZone sun.util.calendar.ZoneInfo[id="GMT+04:00",offset=14400000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
first timezone offset / min 240
second timezone sun.util.calendar.ZoneInfo[id="GMT+07:00",offset=25200000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
second timezone offset / min 420
monthView locale: en
monthView anchor Tue Nov 30 18:29:35 UTC 2021
monthView firstDisplayed Tue Nov 30 17:00:00 UTC 2021 expected:<-180> but was:<43020>

windows:

junit.framework.AssertionFailedError: first displayed must be offset by real offset expected:<-10800000> but was:<2581200000>
	at junit.framework.Assert.fail(Assert.java:57)
	at junit.framework.Assert.failNotEquals(Assert.java:329)
	at junit.framework.Assert.assertEquals(Assert.java:78)
	at junit.framework.Assert.assertEquals(Assert.java:159)
	at junit.framework.TestCase.assertEquals(TestCase.java:302)
	at org.jdesktop.swingx.JXMonthViewTest.testTimeZoneChangeOffsetFirstDisplayedDate(JXMonthViewTest.java:2126)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)

@homebeaver
Copy link
Owner Author

war bereits issue 618!!!

testTimeZoneChangeToday

    /**
     * Issue #618-swingx: JXMonthView displays problems with non-default
     * timezones.
     * 
     * Here: test that the first displayed date is offset by offset diff of
     * timezones. Configure the monthView with a fixed timezone to clear up the
     * mist ...
     * 
     * This did fail on the server on 31mar2008, us/pacific timezone, en_US
     * locale. Trying to sim the context then.
     * 
     * Failed again at Tue Sep 30 10:12:31 PDT 2008, en_US locale. Next
     * (testTimeZoneChangeOffsetFirstDisplayedDate) failed at the same time, 
     */
    @Test
    public void testTimeZoneChangeToday() {
...
        String server = "server locale: " + Locale.getDefault()
                + "\n server timezone: " + localCal.getTimeZone()
                + "\n server local time: " + localCal.getTime();
        String timeZones = "first timeZone " + tz
                + "\n first timezone offset / min " + oldOffset / (1000 * 60)
                + "\n second timezone " + tzOther
                + "\n second timezone offset / min " + newOffset / (1000 * 60);
        String monthViewProps = "monthView locale: " + monthView.getLocale()
                + "\n monthView anchor " + anchor
                + "\n monthView firstDisplayed " + monthView.getFirstDisplayedDay();

        LOG.info("\n "+server + "\n "+timeZones + "\n "+monthViewProps); // print exected
        assertEquals(                                                  // JXMonthViewTest.java:2042
                "first displayed must be offset by real offset "
                        + "\n ********** spurious failure - so try extensiv debug output:"
                        + "\n " + server 
                        + "\n " + timeZones 
                        + "\n " + monthViewProps, 
                (realOffset) / (1000 * 60),
                (monthView.getFirstDisplayedDay().getTime() - firstDisplayed.getTime()) / (1000 * 60));

ist vs expected

monthView anchor Tue Nov 30 20:42:59 CET 2021 // is
monthView anchor Tue Nov 30 20:52:25 CET 2021 // expected

Unix:

siehe https://github.com/homebeaver/SwingSet3/actions/runs/1522343606

Error: Tests run: 144, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 2.312 s <<< FAILURE! - in org.jdesktop.swingx.JXMonthViewTest
Error: testTimeZoneChangeOffsetFirstDisplayedDate(org.jdesktop.swingx.JXMonthViewTest) Time elapsed: 0.006 s <<< FAILURE!
junit.framework.AssertionFailedError: first displayed must be offset by real offset expected:<-10800000> but was:<2581200000>
at org.jdesktop.swingx.JXMonthViewTest.testTimeZoneChangeOffsetFirstDisplayedDate(JXMonthViewTest.java:2126)

Error: testTimeZoneChangeToday(org.jdesktop.swingx.JXMonthViewTest) Time elapsed: 0.026 s <<< FAILURE!
junit.framework.AssertionFailedError:

first displayed must be offset by real offset 
 ********** spurious failure - so try extensiv debug output:
 server locale: en
 server timezone: sun.util.calendar.ZoneInfo[id="Etc/UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
 server local time: Tue Nov 30 18:29:35 UTC 2021
 first timeZone sun.util.calendar.ZoneInfo[id="GMT+04:00",offset=14400000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
 first timezone offset / min 240
 second timezone sun.util.calendar.ZoneInfo[id="GMT+07:00",offset=25200000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
 second timezone offset / min 420
 monthView locale: en
 monthView anchor Tue Nov 30 18:29:35 UTC 2021
 monthView firstDisplayed Tue Nov 30 17:00:00 UTC 2021 expected:<-180> but was:<43020>
	at org.jdesktop.swingx.JXMonthViewTest.testTimeZoneChangeToday(JXMonthViewTest.java:2042)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant