|
2 | 2 | // Distributed under the MIT software license, see the accompanying
|
3 | 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
4 | 4 |
|
| 5 | +#include <init.h> |
5 | 6 | #include <qt/bitcoin.h>
|
6 | 7 | #include <qt/test/optiontests.h>
|
7 | 8 | #include <test/util/setup_common.h>
|
@@ -29,3 +30,39 @@ void OptionTests::optionTests()
|
29 | 30 | });
|
30 | 31 | gArgs.WriteSettingsFile();
|
31 | 32 | }
|
| 33 | + |
| 34 | +void OptionTests::parametersInteraction() |
| 35 | +{ |
| 36 | + // Test that the bug https://github.com/bitcoin-core/gui/issues/567 does not resurface. |
| 37 | + // It was fixed via https://github.com/bitcoin-core/gui/pull/568. |
| 38 | + // With fListen=false in ~/.config/Bitcoin/Bitcoin-Qt.conf and all else left as default, |
| 39 | + // bitcoin-qt should set both -listen and -listenonion to false and start successfully. |
| 40 | + gArgs.ClearPathCache(); |
| 41 | + |
| 42 | + gArgs.LockSettings([&](util::Settings& s) { |
| 43 | + s.forced_settings.erase("listen"); |
| 44 | + s.forced_settings.erase("listenonion"); |
| 45 | + }); |
| 46 | + QVERIFY(!gArgs.IsArgSet("-listen")); |
| 47 | + QVERIFY(!gArgs.IsArgSet("-listenonion")); |
| 48 | + |
| 49 | + QSettings settings; |
| 50 | + settings.setValue("fListen", false); |
| 51 | + |
| 52 | + OptionsModel{}; |
| 53 | + |
| 54 | + const bool expected{false}; |
| 55 | + |
| 56 | + QVERIFY(gArgs.IsArgSet("-listen")); |
| 57 | + QCOMPARE(gArgs.GetBoolArg("-listen", !expected), expected); |
| 58 | + |
| 59 | + QVERIFY(gArgs.IsArgSet("-listenonion")); |
| 60 | + QCOMPARE(gArgs.GetBoolArg("-listenonion", !expected), expected); |
| 61 | + |
| 62 | + QVERIFY(AppInitParameterInteraction(gArgs)); |
| 63 | + |
| 64 | + // cleanup |
| 65 | + settings.remove("fListen"); |
| 66 | + QVERIFY(!settings.contains("fListen")); |
| 67 | + gArgs.ClearPathCache(); |
| 68 | +} |
0 commit comments