diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-04-03 12:40:45 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-02-12 19:40:21 +0000 |
commit | 8bccf93300a4fb921fd9b59bf346f6a6b08dfe53 (patch) | |
tree | e448b16a9d8d7714f9a8202f69fa27dc3b8fb99c /tests/auto/gui/kernel/qkeysequence | |
parent | c94d41d903e8978efc084ff96e1ac45a46feb6e8 (diff) |
Make the QPlatformTheme::keyBindings() search deterministic
QPlatformTheme::keyBindings() performs a binary search
into an ordered list of StandardKey -> Key Sequence
mappings where each StandardKey can have multiple
key sequences.
Previously the order of the Key Sequences in the
returned list would be indeterministic and, except
for the designated pri-1 key sequence, would not
necessarily correspond to the list order. (The
ordering was dependent on where the binary search
"hits", which again depends on the size of the list.)
This caused trouble when adding mappings, since it
would change the order in the returned key sequence
list for existing mappings and confusingly cause
(apparently) unrelated test failures.
Fix this by replacing the manually coded binary search
with std::equal_range.
One test case needed to be fixed up because it had the
result in the wrong order (verified by looking at
QPlatformTheme::keyBindings).
Change-Id: I555ca2736b1a8e6454dc79645a8246f80119cfc2
Done-with: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'tests/auto/gui/kernel/qkeysequence')
-rw-r--r-- | tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index b6ce2fb4b7..2edfddf6dd 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -391,7 +391,7 @@ void tst_QKeySequence::keyBindings() expected << ctrlC << ctrlInsert; break; default: // X11 - expected << ctrlC << QKeySequence(QStringLiteral("F16")) << ctrlInsert; + expected << ctrlC << ctrlInsert << QKeySequence(QStringLiteral("F16")); break; } QCOMPARE(bindings, expected); |