mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
test: add regression test for bitcoin-core/gui/issues/567
This commit is contained in:
parent
3b82608dd1
commit
4d4dca43fc
2 changed files with 38 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#include <init.h>
|
||||||
#include <qt/bitcoin.h>
|
#include <qt/bitcoin.h>
|
||||||
#include <qt/test/optiontests.h>
|
#include <qt/test/optiontests.h>
|
||||||
#include <test/util/setup_common.h>
|
#include <test/util/setup_common.h>
|
||||||
|
@ -29,3 +30,39 @@ void OptionTests::optionTests()
|
||||||
});
|
});
|
||||||
gArgs.WriteSettingsFile();
|
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");
|
||||||
|
});
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ public:
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void optionTests();
|
void optionTests();
|
||||||
|
void parametersInteraction();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
interfaces::Node& m_node;
|
interfaces::Node& m_node;
|
||||||
|
|
Loading…
Add table
Reference in a new issue