Extend unittests to test stable sort.
Summary:
- Helper function constructs a permutation of the list of menu-items that need to be sorted, then sorts and tests.
- Test ten permutations of the list of items (not all of them, since it's a stable sort some permutations must produce a different sorted output, so no std::next_permutation here).
Fix stable sorting of menu items.
In the case i1 installed, but in section Main, and i2 uninstalled, this
lambda returned False, meaning that i1 was not less than i2. Change
comparison to always sort installed before uninstalled.
Test Plan:
Revert the change to src/kmoretools/kmoretools_p.h to see the
sorting test fail; restore the change for the fix.
Reviewers: whiting, Frameworks, leinir
Reviewed By: leinir
Subscribers: leinir, Frameworks
Tags: Frameworks
Differential Revision: https://phabricator.kde.org/D6049