/* * Copyright (C) QSfera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #include "common/version.h" #include "configfile.h" #include #include #include using namespace OCC; using namespace Qt::Literals::StringLiterals; class TestConfigFile : public QObject { Q_OBJECT private Q_SLOTS: void init() { QVERIFY(_configDir.isValid()); QVERIFY(ConfigFile::setConfDir(_configDir.path())); QFile::remove(ConfigFile::configFile()); } void testDefaultUpdateChannelMatchesBuildChannel() { const auto expectedChannel = Version::isBeta() ? u"beta"_s : u"stable"_s; QCOMPARE(ConfigFile().updateChannel(), expectedChannel); } void testStoredUpdateChannelOverridesBuildDefault() { ConfigFile().setUpdateChannel(u"beta"_s); QCOMPARE(ConfigFile().updateChannel(), u"beta"_s); ConfigFile().setUpdateChannel(u"stable"_s); QCOMPARE(ConfigFile().updateChannel(), u"stable"_s); } private: QTemporaryDir _configDir; }; QTEST_MAIN(TestConfigFile) #include "testconfigfile.moc"