From 7d9a091ddc4b415ef6074ce5e7f216cfd7622035 Mon Sep 17 00:00:00 2001 From: Dmitry Degtyarev Date: Tue, 25 May 2021 13:31:17 +0400 Subject: [PATCH] remove tab(); usage from test inits use findChild() instead *probably* fixes tests failing on KDE --- tests/admc_test_country_edit.cpp | 3 +-- tests/admc_test_string_edit.cpp | 3 +-- tests/admc_test_unlock_edit.cpp | 3 +-- tests/admc_test_upn_edit.cpp | 5 ++--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/admc_test_country_edit.cpp b/tests/admc_test_country_edit.cpp index 724e6277..205d754e 100644 --- a/tests/admc_test_country_edit.cpp +++ b/tests/admc_test_country_edit.cpp @@ -38,8 +38,7 @@ void ADMCTestCountryEdit::init() { parent_widget->show(); QVERIFY(QTest::qWaitForWindowExposed(parent_widget, 1000)); - tab(); - combo = qobject_cast(QApplication::focusWidget()); + combo = parent_widget->findChild(); QVERIFY(combo != nullptr); // Create test user diff --git a/tests/admc_test_string_edit.cpp b/tests/admc_test_string_edit.cpp index fd5c1cb2..324f4e41 100644 --- a/tests/admc_test_string_edit.cpp +++ b/tests/admc_test_string_edit.cpp @@ -39,8 +39,7 @@ void ADMCTestStringEdit::init() { parent_widget->show(); QVERIFY(QTest::qWaitForWindowExposed(parent_widget, 1000)); - tab(); - line_edit = qobject_cast(QApplication::focusWidget()); + line_edit = parent_widget->findChild(); QVERIFY(line_edit != nullptr); // Create test user diff --git a/tests/admc_test_unlock_edit.cpp b/tests/admc_test_unlock_edit.cpp index 687364e8..23d34b8e 100644 --- a/tests/admc_test_unlock_edit.cpp +++ b/tests/admc_test_unlock_edit.cpp @@ -43,8 +43,7 @@ void ADMCTestUnlockEdit::init() { parent_widget->show(); QVERIFY(QTest::qWaitForWindowExposed(parent_widget, 1000)); - tab(); - checkbox = qobject_cast(QApplication::focusWidget()); + checkbox = parent_widget->findChild(); QVERIFY(checkbox != nullptr); // Create test user diff --git a/tests/admc_test_upn_edit.cpp b/tests/admc_test_upn_edit.cpp index fc85c328..70d16103 100644 --- a/tests/admc_test_upn_edit.cpp +++ b/tests/admc_test_upn_edit.cpp @@ -40,11 +40,10 @@ void ADMCTestUpnEdit::init() { parent_widget->show(); QVERIFY(QTest::qWaitForWindowExposed(parent_widget, 1000)); - prefix_edit = qobject_cast(QApplication::focusWidget()); + prefix_edit = parent_widget->findChild(); QVERIFY(prefix_edit != nullptr); - tab(); - suffix_edit = qobject_cast(QApplication::focusWidget()); + suffix_edit = parent_widget->findChild(); QVERIFY(suffix_edit != nullptr); // Create test user