2929
3030#include < QAbstractButton>
3131#include < QApplication>
32+ #include < QCheckBox>
3233#include < QComboBox>
3334#include < QDoubleSpinBox>
3435#include < QLabel>
@@ -666,8 +667,10 @@ void MasternodeWidgetTests::masternodeListRegistrationAvailability()
666667
667668 MasternodeList list;
668669 auto * const register_button{list.findChild <QPushButton*>(" btnRegisterMasternode" )};
670+ auto * const owned_checkbox{list.findChild <QCheckBox*>(" checkBoxOwned" )};
669671 auto * const context_menu{list.findChild <QMenu*>(QString{}, Qt::FindDirectChildrenOnly)};
670672 QVERIFY (register_button != nullptr );
673+ QVERIFY (owned_checkbox != nullptr );
671674 QVERIFY (context_menu != nullptr );
672675 QVERIFY (context_menu->toolTipsVisible ());
673676 QVERIFY (!register_button->isEnabled ());
@@ -680,6 +683,20 @@ void MasternodeWidgetTests::masternodeListRegistrationAvailability()
680683 list.setClientModel (&client_model);
681684 QVERIFY (register_button->isEnabled ());
682685
686+ owned_checkbox->setChecked (true );
687+ list.setWalletModel (nullptr );
688+ QVERIFY (!register_button->isEnabled ());
689+ QVERIFY (register_button->toolTip ().contains (" requires a wallet" , Qt::CaseInsensitive));
690+ QVERIFY (!owned_checkbox->isEnabled ());
691+ QVERIFY (!owned_checkbox->isChecked ());
692+
693+ // Attaching the wallet again restores the user's saved owned-only choice.
694+ list.setWalletModel (&wallet_model);
695+ QVERIFY (register_button->isEnabled ());
696+ QVERIFY (owned_checkbox->isEnabled ());
697+ QVERIFY (owned_checkbox->isChecked ());
698+ owned_checkbox->setChecked (false );
699+
683700 list.setClientModel (nullptr );
684701 QVERIFY (!register_button->isEnabled ());
685702 QVERIFY (register_button->toolTip ().contains (" node is ready" , Qt::CaseInsensitive));
0 commit comments