summaryrefslogtreecommitdiff
path: root/src/test/test_rekonqwindow.cpp
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2022-09-05 16:17:50 +0300
committeraqua <aqua@iserlohn-fortress.net>2022-09-05 23:07:42 +0300
commit6b0c8f7e769a141f13194cf341e888c9b49f294c (patch)
tree308895235933e1246759ffb540269a349d0ef151 /src/test/test_rekonqwindow.cpp
parentUrlBar: add completer (diff)
downloadrekonq-6b0c8f7e769a141f13194cf341e888c9b49f294c.tar.xz
Add RekonqWindow tests
Diffstat (limited to 'src/test/test_rekonqwindow.cpp')
-rw-r--r--src/test/test_rekonqwindow.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/test_rekonqwindow.cpp b/src/test/test_rekonqwindow.cpp
new file mode 100644
index 00000000..9e90cd94
--- /dev/null
+++ b/src/test/test_rekonqwindow.cpp
@@ -0,0 +1,38 @@
+#include "rekonqwindow_mock.hpp"
+#include "settings_mock.hpp"
+#include <QApplication>
+#include <QRegularExpression>
+#include <gtest/gtest.h>
+
+using ::testing::_; // NOLINT(bugprone-reserved-identifier)
+using ::testing::Matcher;
+using ::testing::ReturnArg;
+
+TEST(RekonqWindow, mock_shortcuts)
+{
+ FakeWindow window;
+ EXPECT_CALL(window, currentView).Times(0);
+ EXPECT_CALL(window, addView).Times(0);
+ EXPECT_CALL(window, loadUrl(Matcher<rekonq::DefaultUrl>(_), _)).Times(0);
+ EXPECT_CALL(window, loadUrl(Matcher<const QUrl &>(_), _)).Times(0);
+
+ for (auto *action : window.findChildren<QAction *>(QRegularExpression("^action.*"))) {
+ EXPECT_TRUE(action->shortcut().isEmpty()) << qUtf8Printable(action->objectName());
+ }
+
+ MockSettings settings;
+ EXPECT_CALL(settings, value).WillRepeatedly(ReturnArg<0>());
+
+ window.setupShortcuts(&settings);
+ for (auto *action : window.findChildren<QAction *>(QRegularExpression("^action.*"))) {
+ EXPECT_FALSE(action->shortcut().isEmpty()) << qUtf8Printable(action->objectName());
+ }
+}
+
+int main(int argc, char **argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ QApplication app(argc, argv);
+
+ return RUN_ALL_TESTS();
+}