This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 137748 - KeymapViewModelTest.testChangeShortcutsOk fails
Summary: KeymapViewModelTest.testChangeShortcutsOk fails
Status: RESOLVED WONTFIX
Alias: None
Product: editor
Classification: Unclassified
Component: Key bindings (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Svata Dedic
URL:
Keywords: TEST
Depends on:
Blocks:
 
Reported: 2008-06-19 17:13 UTC by Jesse Glick
Modified: 2016-07-07 07:30 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


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
Comment 11 Martin Balin 2016-07-07 07:30:49 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss