Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8310238

[test bug] javax/swing/JTableHeader/6889007/bug6889007.java fails

    XMLWordPrintable

Details

    Backports

      Description

        The stability improvements for https://bugs.openjdk.org/browse/JDK-8299713
        didn't help and this test fails every time in CI the first time it is run.

        It passes on re-run because in that case the preceding test is different.
        And the preceding test on the first run is a somewhat similar test which just
        uses a TableHeader but is dragging the headers around and uses a decorated window
        The key is that leaves the cursor always in the same position
        right around the where the final column of the table will be drawn in this test
        That other test is javax/swing/JTableHeader/6884066/bug6884066.java

        As a result when this test (bug6889007.java) is run on its own you see this (print the state each time, not just on error)
        oldColumn -1 newColumn 0header.getCursor java.awt.Cursor[Default Cursor] cursor java.awt.Cursor[East Resize Cursor]
        oldColumn 0 newColumn 1header.getCursor java.awt.Cursor[East Resize Cursor] cursor java.awt.Cursor[East Resize Cursor]
        oldColumn 1 newColumn 2header.getCursor java.awt.Cursor[East Resize Cursor] cursor java.awt.Cursor[East Resize Cursor]
        oldColumn 2 newColumn 3header.getCursor java.awt.Cursor[East Resize Cursor] cursor java.awt.Cursor[East Resize Cursor]
        oldColumn 3 newColumn 4header.getCursor java.awt.Cursor[East Resize Cursor] cursor java.awt.Cursor[East Resize Cursor]
        oldColumn 4 newColumn -1header.getCursor java.awt.Cursor[East Resize Cursor] cursor java.awt.Cursor[East Resize Cursor]

        but when you run it after the decorated test - or by placing the mouse pointer at the exact place on the screen where column 4
        will be rendered you see something like this
        oldColumn -1 newColumn 4header.getCursor java.awt.Cursor[Default Cursor] cursor java.awt.Cursor[East Resize Cursor]
        oldColumn 4 newColumn 0header.getCursor java.awt.Cursor[Default Cursor] cursor java.awt.Cursor[East Resize Cursor]
        Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Wrong type of cursor!
            at bug6889007$MyTableHeaderUI.rolloverColumnUpdated(bug6889007.java:125)

        So if the mouse starts *anywhere* over the window then the test will fail.

        The easy fix is to move the mouse to some other location first, or a bit trickier (but will also work on Wayland) is to see
        if location is within this window before starting the movements and set a flag not to ignore the case when newColumn == 0
        regardless of the value of oldColumn. Perhaps do both.

        Attachments

          Issue Links

            Activity

              People

                prr Philip Race
                prr Philip Race
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: