-
Notifications
You must be signed in to change notification settings - Fork 353
test: add regression test for #567 #569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| // Distributed under the MIT software license, see the accompanying | ||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
|
||
| #include <init.h> | ||
| #include <qt/bitcoin.h> | ||
| #include <qt/test/optiontests.h> | ||
| #include <test/util/setup_common.h> | ||
|
|
@@ -29,3 +30,39 @@ void OptionTests::optionTests() | |
| }); | ||
| gArgs.WriteSettingsFile(); | ||
| } | ||
|
|
||
| void OptionTests::parametersInteraction() | ||
| { | ||
| // Test that the bug https://github.com/bitcoin-core/gui/issues/567 does not resurface. | ||
| // It was fixed via https://github.com/bitcoin-core/gui/pull/568. | ||
| // With fListen=false in ~/.config/Bitcoin/Bitcoin-Qt.conf and all else left as default, | ||
| // bitcoin-qt should set both -listen and -listenonion to false and start successfully. | ||
| gArgs.ClearPathCache(); | ||
|
|
||
| gArgs.LockSettings([&](util::Settings& s) { | ||
| s.forced_settings.erase("listen"); | ||
| s.forced_settings.erase("listenonion"); | ||
| }); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added asserts here as a sanity check, maybe good to add in case the defaults in void OptionTests::parametersInteraction()
{
+ QVERIFY(gArgs.IsArgSet("-listen"));
+ QVERIFY(gArgs.IsArgSet("-listenonion"));
gArgs.LockSettings([&](util::Settings& s) {
s.forced_settings.erase("listen");
s.forced_settings.erase("listenonion");
}
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test unsets those options, so it does not care or rely that they are set when it starts. Thus I think those checks are not necessary. I.e. the test will still work even if those options are not set when it starts. |
||
| QVERIFY(!gArgs.IsArgSet("-listen")); | ||
| QVERIFY(!gArgs.IsArgSet("-listenonion")); | ||
|
|
||
| QSettings settings; | ||
| settings.setValue("fListen", false); | ||
|
|
||
| OptionsModel{}; | ||
|
|
||
| const bool expected{false}; | ||
|
|
||
| QVERIFY(gArgs.IsArgSet("-listen")); | ||
| QCOMPARE(gArgs.GetBoolArg("-listen", !expected), expected); | ||
|
|
||
| QVERIFY(gArgs.IsArgSet("-listenonion")); | ||
| QCOMPARE(gArgs.GetBoolArg("-listenonion", !expected), expected); | ||
|
|
||
| QVERIFY(AppInitParameterInteraction(gArgs)); | ||
|
|
||
| // cleanup | ||
| settings.remove("fListen"); | ||
| QVERIFY(!settings.contains("fListen")); | ||
| gArgs.ClearPathCache(); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.