Add search help pop-up

* Support ! modifier (same as '-')
* Create reusable PopupHelpWidget as self-contained popup that can
be positioned around a parent widget and will follow the movement
and sizing of the window
* Eliminated KEEPASSXC_MAIN_WINDOW macro and replaced with
getMainWindow() function
* Add tests to cover search help show/hide
This commit is contained in:
Jonathan White
2018-11-01 21:33:27 -04:00
parent d6ffee5e99
commit 880c3aeb34
20 changed files with 671 additions and 36 deletions

View File

@@ -802,10 +802,22 @@ void TestGui::testSearch()
auto* clearButton = searchWidget->findChild<QAction*>("clearIcon");
QVERIFY(!clearButton->isVisible());
auto* helpButton = searchWidget->findChild<QAction*>("helpIcon");
auto* helpPanel = searchWidget->findChild<QWidget*>("SearchHelpWidget");
QVERIFY(helpButton->isVisible());
QVERIFY(!helpPanel->isVisible());
// Enter search
QTest::mouseClick(searchTextEdit, Qt::LeftButton);
QTRY_VERIFY(searchTextEdit->hasFocus());
QTRY_VERIFY(!clearButton->isVisible());
// Show/Hide search help
helpButton->trigger();
QTRY_VERIFY(helpPanel->isVisible());
QTest::mouseClick(searchTextEdit, Qt::LeftButton);
QTRY_VERIFY(helpPanel->isVisible());
helpButton->trigger();
QTRY_VERIFY(!helpPanel->isVisible());
// Search for "ZZZ"
QTest::keyClicks(searchTextEdit, "ZZZ");
QTRY_COMPARE(searchTextEdit->text(), QString("ZZZ"));