From f138911bd204cedc82f3d9d70ec00b903744dd98 Mon Sep 17 00:00:00 2001 From: Dmitry Degtyarev Date: Wed, 22 Dec 2021 16:26:03 +0400 Subject: [PATCH] fix compilation of tests --- tests/admc_test_account_option_edit.cpp | 4 +--- tests/admc_test_attributes_tab.cpp | 26 +++++++++++------------- tests/admc_test_attributes_tab.h | 2 +- tests/admc_test_country_edit.cpp | 2 +- tests/admc_test_datetime_edit.cpp | 2 +- tests/admc_test_delegation_edit.cpp | 2 +- tests/admc_test_expiry_edit.cpp | 2 +- tests/admc_test_gpoptions_edit.cpp | 2 +- tests/admc_test_group_scope_edit.cpp | 2 +- tests/admc_test_group_type_edit.cpp | 2 +- tests/admc_test_logon_computers_edit.cpp | 2 +- tests/admc_test_manager_edit.cpp | 2 +- tests/admc_test_member_of_tab.cpp | 23 ++++++++++++--------- tests/admc_test_member_of_tab.h | 4 ++-- tests/admc_test_members_tab.cpp | 23 ++++++++++++--------- tests/admc_test_members_tab.h | 4 ++-- tests/admc_test_password_edit.cpp | 2 +- tests/admc_test_string_edit.cpp | 2 +- tests/admc_test_string_large_edit.cpp | 2 +- tests/admc_test_string_other_edit.cpp | 2 +- tests/admc_test_unlock_edit.cpp | 2 +- tests/admc_test_upn_edit.cpp | 2 +- 22 files changed, 59 insertions(+), 57 deletions(-) diff --git a/tests/admc_test_account_option_edit.cpp b/tests/admc_test_account_option_edit.cpp index 46c3aa02..70ddd4cf 100644 --- a/tests/admc_test_account_option_edit.cpp +++ b/tests/admc_test_account_option_edit.cpp @@ -41,11 +41,9 @@ void ADMCTestAccountOptionEdit::init() { return out; }(); - QList edit_list; - for (const AccountOption &option : option_list) { auto check = new QCheckBox(parent_widget); - auto edit = new AccountOptionEdit(check, option, &edit_list, parent_widget); + auto edit = new AccountOptionEdit(check, option, parent_widget); check_map[option] = check; edit_map[option] = edit; diff --git a/tests/admc_test_attributes_tab.cpp b/tests/admc_test_attributes_tab.cpp index afec5445..9da5c6d0 100644 --- a/tests/admc_test_attributes_tab.cpp +++ b/tests/admc_test_attributes_tab.cpp @@ -52,24 +52,22 @@ const QList all_filters = { void ADMCTestAttributesTab::init() { ADMCTest::init(); - attributes_tab = new AttributesTab(&edit_list, parent_widget); - add_widget(attributes_tab); + view = new QTreeView(parent_widget); + filter_button = new QPushButton(parent_widget); + edit_button = new QPushButton(parent_widget); + auto view_button = new QPushButton(parent_widget); - filter_menu = attributes_tab->findChild(); + edit = new AttributesTabEdit(view, filter_button, edit_button, view_button, parent_widget); + + filter_menu = view->findChild(); QVERIFY(filter_menu); - view = attributes_tab->ui->view; - - model = attributes_tab->findChild(); + model = edit->findChild(); QVERIFY(model); - proxy = attributes_tab->findChild(); + proxy = edit->findChild(); QVERIFY(proxy); - filter_button = attributes_tab->ui->filter_button; - - edit_button = attributes_tab->ui->edit_button; - // Create test user const QString name = TEST_USER; dn = test_object_dn(name, CLASS_USER); @@ -78,7 +76,7 @@ void ADMCTestAttributesTab::init() { // Load it into the tab const AdObject object = ad.search_object(dn); - AttributeEdit::load(edit_list, ad, object); + edit->load(ad, object); // NOTE: filters might be messed up in settings by user // so reset it before tests @@ -172,7 +170,7 @@ void ADMCTestAttributesTab::apply() { navigate_until_object(view, "description", Qt::DisplayRole); edit_button->click(); - auto list_attribute_dialog = attributes_tab->findChild(); + auto list_attribute_dialog = view->findChild(); QVERIFY(list_attribute_dialog); QVERIFY(QTest::qWaitForWindowExposed(list_attribute_dialog, 1000)); @@ -189,7 +187,7 @@ void ADMCTestAttributesTab::apply() { string_attribute_dialog->accept(); list_attribute_dialog->accept(); - AttributeEdit::apply(ad, edit_list, dn); + edit->apply(ad, dn); const AdObject object = ad.search_object(dn); const QString description_value = object.get_string(ATTRIBUTE_DESCRIPTION); diff --git a/tests/admc_test_attributes_tab.h b/tests/admc_test_attributes_tab.h index 24c9d73a..579a2a95 100644 --- a/tests/admc_test_attributes_tab.h +++ b/tests/admc_test_attributes_tab.h @@ -46,7 +46,7 @@ private slots: void filter(); private: - AttributesTab *attributes_tab; + AttributeEdit *edit; AttributesTabFilterMenu *filter_menu; QTreeView *view; QStandardItemModel *model; diff --git a/tests/admc_test_country_edit.cpp b/tests/admc_test_country_edit.cpp index 0d1745b1..b193330b 100644 --- a/tests/admc_test_country_edit.cpp +++ b/tests/admc_test_country_edit.cpp @@ -35,7 +35,7 @@ void ADMCTestCountryEdit::init() { combo = new QComboBox(parent_widget); - edit = new CountryEdit(combo, &edits, parent_widget); + edit = new CountryEdit(combo, parent_widget); // Create test user const QString name = TEST_USER; diff --git a/tests/admc_test_datetime_edit.cpp b/tests/admc_test_datetime_edit.cpp index 5ad9d939..03afb94f 100644 --- a/tests/admc_test_datetime_edit.cpp +++ b/tests/admc_test_datetime_edit.cpp @@ -33,7 +33,7 @@ void ADMCTestDateTimeEdit::init() { qedit = new QDateTimeEdit(parent_widget); - edit = new DateTimeEdit(qedit, ATTRIBUTE_WHEN_CHANGED, &edits, parent_widget); + edit = new DateTimeEdit(qedit, ATTRIBUTE_WHEN_CHANGED, parent_widget); const QString name = TEST_USER; dn = test_object_dn(name, CLASS_USER); diff --git a/tests/admc_test_delegation_edit.cpp b/tests/admc_test_delegation_edit.cpp index 997eda2e..c1e2a456 100644 --- a/tests/admc_test_delegation_edit.cpp +++ b/tests/admc_test_delegation_edit.cpp @@ -39,7 +39,7 @@ void ADMCTestDelegationEdit::init() { auto on_button = new QRadioButton(parent_widget); auto off_button = new QRadioButton(parent_widget); - edit = new DelegationEdit(off_button, on_button, &edits, parent_widget); + edit = new DelegationEdit(off_button, on_button, parent_widget); QFETCH_GLOBAL(bool, use_on_button); button = [&]() { diff --git a/tests/admc_test_expiry_edit.cpp b/tests/admc_test_expiry_edit.cpp index 65f6ba67..6803ce3f 100644 --- a/tests/admc_test_expiry_edit.cpp +++ b/tests/admc_test_expiry_edit.cpp @@ -44,7 +44,7 @@ void ADMCTestExpiryEdit::init() { auto widget = new ExpiryWidget(parent_widget); - edit = new ExpiryEdit(widget, &edits, parent_widget); + edit = new ExpiryEdit(widget, parent_widget); date_edit = widget->ui->date_edit; diff --git a/tests/admc_test_gpoptions_edit.cpp b/tests/admc_test_gpoptions_edit.cpp index 1f42ec6a..b0d9237e 100644 --- a/tests/admc_test_gpoptions_edit.cpp +++ b/tests/admc_test_gpoptions_edit.cpp @@ -32,7 +32,7 @@ void ADMCTestGpoptionsEdit::init() { check = new QCheckBox(parent_widget); - edit = new GpoptionsEdit(check, &edits, parent_widget); + edit = new GpoptionsEdit(check, parent_widget); const QString name = TEST_OU; dn = test_object_dn(name, CLASS_OU); diff --git a/tests/admc_test_group_scope_edit.cpp b/tests/admc_test_group_scope_edit.cpp index f1909e94..ef6f0598 100644 --- a/tests/admc_test_group_scope_edit.cpp +++ b/tests/admc_test_group_scope_edit.cpp @@ -30,7 +30,7 @@ void ADMCTestGroupScopeEdit::init() { combo = new QComboBox(parent_widget); - edit = new GroupScopeEdit(combo, &edits, parent_widget); + edit = new GroupScopeEdit(combo, parent_widget); const QString name = TEST_GROUP; dn = test_object_dn(name, CLASS_GROUP); diff --git a/tests/admc_test_group_type_edit.cpp b/tests/admc_test_group_type_edit.cpp index 9fba8f7f..7a9ba07b 100644 --- a/tests/admc_test_group_type_edit.cpp +++ b/tests/admc_test_group_type_edit.cpp @@ -30,7 +30,7 @@ void ADMCTestGroupTypeEdit::init() { combo = new QComboBox(parent_widget); - edit = new GroupTypeEdit(combo, &edits, parent_widget); + edit = new GroupTypeEdit(combo, parent_widget); const QString name = TEST_GROUP; dn = test_object_dn(name, CLASS_GROUP); diff --git a/tests/admc_test_logon_computers_edit.cpp b/tests/admc_test_logon_computers_edit.cpp index 7ded5293..dfef7e57 100644 --- a/tests/admc_test_logon_computers_edit.cpp +++ b/tests/admc_test_logon_computers_edit.cpp @@ -34,7 +34,7 @@ void ADMCTestLogonComputersEdit::init() { auto open_dialog_button = new QPushButton(parent_widget); - edit = new LogonComputersEdit(open_dialog_button, &edits, parent_widget); + edit = new LogonComputersEdit(open_dialog_button, parent_widget); const QString name = TEST_USER; dn = test_object_dn(name, CLASS_USER); diff --git a/tests/admc_test_manager_edit.cpp b/tests/admc_test_manager_edit.cpp index f2baab6b..d051a60c 100644 --- a/tests/admc_test_manager_edit.cpp +++ b/tests/admc_test_manager_edit.cpp @@ -34,7 +34,7 @@ void ADMCTestManagerEdit::init() { auto manager_widget = new ManagerWidget(parent_widget); - edit = new ManagerEdit(manager_widget, ATTRIBUTE_MANAGER, &edits, parent_widget); + edit = new ManagerEdit(manager_widget, ATTRIBUTE_MANAGER, parent_widget); manager_display = manager_widget->ui->manager_display; change_button = manager_widget->ui->change_button; diff --git a/tests/admc_test_member_of_tab.cpp b/tests/admc_test_member_of_tab.cpp index 5ce0e231..e9ea5b68 100644 --- a/tests/admc_test_member_of_tab.cpp +++ b/tests/admc_test_member_of_tab.cpp @@ -35,14 +35,17 @@ void ADMCTestMemberOfTab::init() { ADMCTest::init(); - member_of_tab = new MemberOfTab(); - add_widget(member_of_tab); + view = new QTreeView(parent_widget); + auto primary_button = new QPushButton(parent_widget); + add_button = new QPushButton(parent_widget); + remove_button = new QPushButton(parent_widget); + auto properties_button = new QPushButton(parent_widget); + auto primary_group_label = new QLabel(parent_widget); - view = member_of_tab->ui->view; - model = member_of_tab->findChild(); + edit = new MembershipTabEdit(view, primary_button, add_button, remove_button, properties_button, primary_group_label, MembershipTabType_MemberOf, parent_widget); + + model = edit->findChild(); QVERIFY(model); - add_button = member_of_tab->ui->add_button; - remove_button = member_of_tab->ui->remove_button; // Create test user const QString user_name = TEST_USER; @@ -58,7 +61,7 @@ void ADMCTestMemberOfTab::init() { // Load it into the tab const AdObject object = ad.search_object(user_dn); - member_of_tab->load(ad, object); + edit->load(ad, object); } // Loading a group without members should result in empty @@ -74,7 +77,7 @@ void ADMCTestMemberOfTab::load() { QVERIFY(add_success); const AdObject object = ad.search_object(user_dn); - member_of_tab->load(ad, object); + edit->load(ad, object); QCOMPARE(model->rowCount(), 2); @@ -105,7 +108,7 @@ void ADMCTestMemberOfTab::remove() { remove_button->click(); - member_of_tab->apply(ad, user_dn); + edit->apply(ad, user_dn); const AdObject updated_object = ad.search_object(user_dn); const QList member_list = updated_object.get_strings(ATTRIBUTE_MEMBER_OF); @@ -120,7 +123,7 @@ void ADMCTestMemberOfTab::add() { select_object_dialog_select(group_dn); // Apply and check object state - member_of_tab->apply(ad, user_dn); + edit->apply(ad, user_dn); const AdObject object = ad.search_object(user_dn); const QList member_of_list = object.get_strings(ATTRIBUTE_MEMBER_OF); QVERIFY(member_of_list.contains(group_dn)); diff --git a/tests/admc_test_member_of_tab.h b/tests/admc_test_member_of_tab.h index e5922b3a..ecca6b7c 100644 --- a/tests/admc_test_member_of_tab.h +++ b/tests/admc_test_member_of_tab.h @@ -24,7 +24,7 @@ #include "admc_test.h" class QTreeView; -class MemberOfTab; +class AttributeEdit; class QStandardItemModel; class QPushButton; @@ -40,7 +40,7 @@ private slots: void add(); private: - MemberOfTab *member_of_tab; + AttributeEdit *edit; QTreeView *view; QStandardItemModel *model; QString user_dn; diff --git a/tests/admc_test_members_tab.cpp b/tests/admc_test_members_tab.cpp index e861a38f..1e8cce2a 100644 --- a/tests/admc_test_members_tab.cpp +++ b/tests/admc_test_members_tab.cpp @@ -32,14 +32,17 @@ void ADMCTestMembersTab::init() { ADMCTest::init(); - members_tab = new MembersTab(); - add_widget(members_tab); + view = new QTreeView(parent_widget); + auto primary_button = new QPushButton(parent_widget); + add_button = new QPushButton(parent_widget); + remove_button = new QPushButton(parent_widget); + auto properties_button = new QPushButton(parent_widget); + auto primary_group_label = new QLabel(parent_widget); - view = members_tab->ui->view; - model = members_tab->findChild(); + edit = new MembershipTabEdit(view, primary_button, add_button, remove_button, properties_button, primary_group_label, MembershipTabType_Members, parent_widget); + + model = edit->findChild(); QVERIFY(model); - add_button = members_tab->ui->add_button; - remove_button = members_tab->ui->remove_button; // Create test user const QString user_name = TEST_USER; @@ -55,7 +58,7 @@ void ADMCTestMembersTab::init() { // Load it into the tab const AdObject object = ad.search_object(group_dn); - members_tab->load(ad, object); + edit->load(ad, object); } // Loading a group without members should result in empty @@ -71,7 +74,7 @@ void ADMCTestMembersTab::load() { QVERIFY(add_success); const AdObject object = ad.search_object(group_dn); - members_tab->load(ad, object); + edit->load(ad, object); QCOMPARE(model->rowCount(), 1); @@ -88,7 +91,7 @@ void ADMCTestMembersTab::remove() { remove_button->click(); - members_tab->apply(ad, group_dn); + edit->apply(ad, group_dn); const AdObject updated_object = ad.search_object(group_dn); const QList member_list = updated_object.get_strings(ATTRIBUTE_MEMBER); @@ -107,7 +110,7 @@ void ADMCTestMembersTab::add() { QCOMPARE(model->item(0, 0)->text(), dn_get_name(user_dn)); // Apply and check object state - members_tab->apply(ad, group_dn); + edit->apply(ad, group_dn); const AdObject object = ad.search_object(group_dn); const QList member_list = object.get_strings(ATTRIBUTE_MEMBER); QCOMPARE(member_list, QList({user_dn})); diff --git a/tests/admc_test_members_tab.h b/tests/admc_test_members_tab.h index 796e307f..528a0ad7 100644 --- a/tests/admc_test_members_tab.h +++ b/tests/admc_test_members_tab.h @@ -24,7 +24,7 @@ #include "admc_test.h" class QTreeView; -class MembersTab; +class AttributeEdit; class QStandardItemModel; class QPushButton; @@ -40,7 +40,7 @@ private slots: void add(); private: - MembersTab *members_tab; + AttributeEdit *edit; QTreeView *view; QStandardItemModel *model; QString user_dn; diff --git a/tests/admc_test_password_edit.cpp b/tests/admc_test_password_edit.cpp index 3583409d..7c6daae4 100644 --- a/tests/admc_test_password_edit.cpp +++ b/tests/admc_test_password_edit.cpp @@ -35,7 +35,7 @@ void ADMCTestPasswordEdit::init() { main_edit = new QLineEdit(parent_widget); confirm_edit = new QLineEdit(parent_widget); - edit = new PasswordEdit(main_edit, confirm_edit, &edits, parent_widget); + edit = new PasswordEdit(main_edit, confirm_edit, parent_widget); // Create test user const QString name = TEST_USER; diff --git a/tests/admc_test_string_edit.cpp b/tests/admc_test_string_edit.cpp index 062e14b9..f2ca93c2 100644 --- a/tests/admc_test_string_edit.cpp +++ b/tests/admc_test_string_edit.cpp @@ -32,7 +32,7 @@ void ADMCTestStringEdit::init() { line_edit = new QLineEdit(parent_widget); - edit = new StringEdit(line_edit, TEST_ATTRIBUTE, &edits, parent_widget); + edit = new StringEdit(line_edit, TEST_ATTRIBUTE, parent_widget); // Create test user const QString name = TEST_USER; diff --git a/tests/admc_test_string_large_edit.cpp b/tests/admc_test_string_large_edit.cpp index ebb7d0be..cf9a8a6b 100644 --- a/tests/admc_test_string_large_edit.cpp +++ b/tests/admc_test_string_large_edit.cpp @@ -32,7 +32,7 @@ void ADMCTestStringLargeEdit::init() { text_edit = new QPlainTextEdit(parent_widget); - edit = new StringLargeEdit(text_edit, TEST_ATTRIBUTE, &edits, parent_widget); + edit = new StringLargeEdit(text_edit, TEST_ATTRIBUTE, parent_widget); // Create test user const QString name = TEST_USER; diff --git a/tests/admc_test_string_other_edit.cpp b/tests/admc_test_string_other_edit.cpp index 9760c9d7..3879ff88 100644 --- a/tests/admc_test_string_other_edit.cpp +++ b/tests/admc_test_string_other_edit.cpp @@ -48,7 +48,7 @@ void ADMCTestStringOtherEdit::init() { line_edit = new QLineEdit(parent_widget); other_button = new QPushButton(parent_widget); - edit = new StringOtherEdit(line_edit, other_button, TEST_ATTRIBUTE_MAIN, ATTRIBUTE_WWW_HOMEPAGE_OTHER, &edits, parent_widget); + edit = new StringOtherEdit(line_edit, other_button, TEST_ATTRIBUTE_MAIN, ATTRIBUTE_WWW_HOMEPAGE_OTHER, parent_widget); // Create test user const QString name = TEST_USER; diff --git a/tests/admc_test_unlock_edit.cpp b/tests/admc_test_unlock_edit.cpp index 8743ca02..7803eeff 100644 --- a/tests/admc_test_unlock_edit.cpp +++ b/tests/admc_test_unlock_edit.cpp @@ -36,7 +36,7 @@ void ADMCTestUnlockEdit::init() { checkbox = new QCheckBox(parent_widget); - unlock_edit = new UnlockEdit(checkbox, &edits, parent_widget); + unlock_edit = new UnlockEdit(checkbox, parent_widget); // Create test user const QString name = TEST_USER; diff --git a/tests/admc_test_upn_edit.cpp b/tests/admc_test_upn_edit.cpp index 1b0b0d8b..d0124d30 100644 --- a/tests/admc_test_upn_edit.cpp +++ b/tests/admc_test_upn_edit.cpp @@ -34,7 +34,7 @@ void ADMCTestUpnEdit::init() { prefix_edit = new QLineEdit(); suffix_edit = new QComboBox(); - upn_edit = new UpnEdit(prefix_edit, suffix_edit, &edits, parent_widget); + upn_edit = new UpnEdit(prefix_edit, suffix_edit, parent_widget); upn_edit->init_suffixes(ad); // Create test user