On Sat, 30 Oct 2021 09:46:13 GMT, Jeanette Winzenburg <faste...@openjdk.org> 
wrote:

>> I don't see an easy way to do that, and I'm not in favor of making private 
>> implementation details package-public just to test some internal state. Of 
>> course, mnemonic support should have been designed in a way that is more 
>> easily testable, but this PR is not the place to do that.
>
> in the skin test, it could be tested indirectly, though not in isolation: 
> 
> - access the actual mnenomic via accessibleAttribute
> - test whether labelFor/action is working as expected when firing an 
> alt-mnemonic onto the scene
> 
> Just noticed that there is no test of TextBinding .. that's where the correct 
> working of the basics should be tested, shouldn't it?

How about adding a JUnit test for TextBinding instead?  The class is 
sufficiently complicated to warrant one, and it has quite a few branches to 
cover.  I think testing it through a `Control` is a bit too high level.

Something like:

    TextBinding tb = new TextBinding("complicated_mnemonic__example_(s)__");

    assertEquals("m", tb.getMnemonic());
    assertEquals(KeyCombination.M, tb.getMnemonicKeyCombination());
    assertEquals(12, tb.getMnemonicIndex());

-------------

PR: https://git.openjdk.java.net/jfx/pull/647

Reply via email to