mirror of
https://github.com/altlinux/admc.git
synced 2025-02-03 05:47:02 +03:00
fix other find dialog tests
add wait_for_find_results_to_load() helper f-n
This commit is contained in:
parent
d245206ef3
commit
5a9d0c196d
@ -160,3 +160,12 @@ void navigate_until_object(QTreeView *view, const QString &target_dn) {
|
||||
|
||||
QFAIL(qPrintable(QString("Failed to navigate to object %1").arg(target_dn)));
|
||||
}
|
||||
|
||||
void ADMCTest::wait_for_find_results_to_load(QTreeView *view) {
|
||||
int timer = 0;
|
||||
while (view->model()->rowCount() == 0) {
|
||||
QTest::qWait(1);
|
||||
timer++;
|
||||
QVERIFY2((timer < 1000), "Find results failed to load, took too long");
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,10 @@ protected:
|
||||
// Tests object's existance on the server.
|
||||
bool object_exists(const QString &dn);
|
||||
|
||||
// Call this after pressing "Find" button. Needed
|
||||
// because find results are loaded in separate thread.
|
||||
void wait_for_find_results_to_load(QTreeView *view);
|
||||
|
||||
};
|
||||
|
||||
void navigate_until_object(QTreeView *view, const QString &target_dn);
|
||||
|
@ -345,6 +345,8 @@ void ADMCTestObjectMenu::object_menu_find_simple()
|
||||
|
||||
auto find_results = find_dialog->findChild<QTreeView*>();
|
||||
|
||||
wait_for_find_results_to_load(find_results);
|
||||
|
||||
QVERIFY2(find_results->model()->rowCount(), "No results found");
|
||||
}
|
||||
|
||||
@ -388,6 +390,8 @@ void ADMCTestObjectMenu::object_menu_find_advanced()
|
||||
|
||||
auto find_results = find_dialog->findChild<QTreeView*>();
|
||||
|
||||
wait_for_find_results_to_load(find_results);
|
||||
|
||||
QVERIFY2(find_results->model()->rowCount(), "No results found");
|
||||
}
|
||||
|
||||
@ -451,14 +455,7 @@ void ADMCTestObjectMenu::object_menu_add_to_group() {
|
||||
auto find_results_view = find_select_dialog->findChild<QTreeView*>();
|
||||
QVERIFY2((find_results_view != nullptr), "Failed to cast find_results_view");
|
||||
|
||||
// NOTE: need to wait for find results to load because
|
||||
// it is done in a separate thread
|
||||
int timer = 0;
|
||||
while (find_results_view->model()->rowCount() == 0) {
|
||||
QTest::qWait(1);
|
||||
timer++;
|
||||
QVERIFY2((timer < 1000), "Find results failed to load, took too long");
|
||||
}
|
||||
wait_for_find_results_to_load(find_results_view);
|
||||
|
||||
// Select group in view
|
||||
navigate_until_object(find_results_view, group_dn);
|
||||
|
Loading…
x
Reference in New Issue
Block a user