Bug 137748 - KeymapViewModelTest.testChangeShortcutsOk fails
KeymapViewModelTest.testChangeShortcutsOk fails
Status: NEW
Product: editor
Classification: Unclassified
Component: Key bindings
6.x
All All
: P4 (vote)
: 7.0
Assigned To: Svata Dedic
issues@editor
: TEST
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-19 17:13 UTC by Jesse Glick
Modified: 2012-10-24 12:00 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2008-06-19 17:13:49 UTC
Was marked as failing randomly, but in fact fails every time I run it.
Comment 1 Jesse Glick 2008-06-19 17:15:03 UTC
Will comment out until fixed.
Comment 2 Jiri Skrivanek 2008-09-16 08:43:44 UTC
Fixed.
http://hg.netbeans.org/core-main/rev/4b3588525a91
Comment 3 Jiri Skrivanek 2008-09-19 11:07:16 UTC
Still failing.
Comment 4 Jiri Skrivanek 2008-09-19 11:17:48 UTC
I tried to fix
options.keymap/test/unit/src/org/netbeans/modules/options/keymap/KeymapViewModelTest.java#testChangeShortcutsOk. But it
is still failing. Maxi, could you look at it? I don't exactly know what it is supposed to do. model.apply() should store
changed shortcuts but it calls "model = new KeymapModel ();" which resets it. I am lost here. Remember that it fails
only in debugger (toggle breakpoint at line with checkShortcuts) because model.apply() is posted to RequestProcessor.
Comment 5 Quality Engineering 2008-09-20 05:43:59 UTC
Integrated into 'main-golden', will be available in build *200809200201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/fb094462d278
User: Jiri Skrivanek <jskrivanek@netbeans.org>
Log: #137748 - testChangeShortcutsOk still failing.
Comment 6 Max Sauer 2008-09-30 13:34:13 UTC
The "model = new KeymapModel ();" does not break anything, since call to changeKeymap stores everything to looked-up keymapmanagers. Jirko, is it a 
problem that it fails in debugger in described scenerio? Normally, the test passes OK for me. In case not, I suggest to close this issue and leave the test 
as such:

public void testChangeShortcutsOk () {
        KeymapViewModel model = new KeymapViewModel ();
        Map<Set<String>,ShortcutAction> shortcuts = setRandomShortcuts (model);
        System.out.println ("apply changes");
        model.apply ();
        System.gc ();
        model.apply ();
        System.gc ();
        checkShortcuts (model, shortcuts, true);
    }

Comment 7 Jiri Skrivanek 2008-10-01 09:43:57 UTC
The problem is that the test failed randomly and if you run it in debugger it fails regularly. As I said it is because
model.apply() is done in RequestProcessor and in fact it doesn't executed if you just run it. The test itself finishes
before RequestProcessor processes its tasks. To reproduce reliably add something like this to the test:

        model.apply ();
        while(model.isChanged()) {
            Thread.sleep(100);
        }

Then the test fails everytime.
Comment 8 Max Sauer 2008-11-19 14:48:24 UTC
This needs to be redesigned, I agree. apply() w/o RequestProcessor would take ages, so we have to find another way of applying the changes.
Comment 9 Quality Engineering 2012-10-23 12:09:08 UTC
Integrated into 'main-golden', will be available in build *201210231040* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/df9fc911dd1f
User: Milutin Kristofic <mkristofic@netbeans.org>
Log: #137748 - KeymapViewModelTest.testChangeShortcutsOk fails
Comment 10 Milutin Kristofic 2012-10-24 12:00:37 UTC
revert my changes in http://hg.netbeans.org/jet-main/rev/db2b9e4fed6f


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo