mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
update: changed QVERIFY to QVERIFY2
This commit is contained in:
@@ -143,7 +143,7 @@ private slots:
|
||||
importResult.config = extractXrayConfig(
|
||||
Utils::JsonToString(serialization::vless::Deserialize(config, &prefix, &errormsg), QJsonDocument::JsonFormat::Compact),
|
||||
configType, prefix);
|
||||
QVERIFY(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
QVERIFY2(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
} else {
|
||||
QSKIP("Config not starts with vless://");
|
||||
}
|
||||
@@ -169,7 +169,7 @@ private slots:
|
||||
importResult.config = extractXrayConfig(
|
||||
Utils::JsonToString(serialization::vmess_new::Deserialize(config, &prefix, &errormsg), QJsonDocument::JsonFormat::Compact),
|
||||
configType, prefix);
|
||||
QVERIFY(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
QVERIFY2(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
} else {
|
||||
QSKIP("Config not starts with vmess:// or not contain @");
|
||||
}
|
||||
@@ -195,7 +195,7 @@ private slots:
|
||||
importResult.config = extractXrayConfig(
|
||||
Utils::JsonToString(serialization::vmess::Deserialize(config, &prefix, &errormsg), QJsonDocument::JsonFormat::Compact),
|
||||
configType, prefix);
|
||||
QVERIFY(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
QVERIFY2(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
} else {
|
||||
QSKIP("Config not starts with vmess://");
|
||||
}
|
||||
@@ -221,7 +221,7 @@ private slots:
|
||||
importResult.config = extractXrayConfig(
|
||||
Utils::JsonToString(serialization::trojan::Deserialize(config, &prefix, &errormsg), QJsonDocument::JsonFormat::Compact),
|
||||
configType, prefix);
|
||||
QVERIFY(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
QVERIFY2(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
} else {
|
||||
QSKIP("Config not starts with trojan://");
|
||||
}
|
||||
@@ -247,7 +247,7 @@ private slots:
|
||||
importResult.config = extractXrayConfig(
|
||||
Utils::JsonToString(serialization::ss::Deserialize(config, &prefix, &errormsg), QJsonDocument::JsonFormat::Compact),
|
||||
configType, prefix);
|
||||
QVERIFY(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
QVERIFY2(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
} else {
|
||||
QSKIP("Config not starts with ss:// or contain plugin=");
|
||||
}
|
||||
@@ -279,7 +279,7 @@ private slots:
|
||||
if (!importResult.config.empty()) {
|
||||
importResult.configType = configType;
|
||||
}
|
||||
QVERIFY(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
QVERIFY2(!importResult.config.empty(), "Config shouldn't be empty");
|
||||
} else {
|
||||
QSKIP("Config not starts with ssd://");
|
||||
}
|
||||
|
||||
@@ -73,31 +73,31 @@ private slots:
|
||||
|
||||
m_coreController->m_allowedDnsUiController->addDns(ip);
|
||||
m_coreController->m_allowedDnsUiController->updateModel();
|
||||
QVERIFY(errorOccurredSpy.count() == 0, "errorOccurred signal should not be emitted");
|
||||
QVERIFY(finishedSpy.count() == 1, "finished signal should be emitted");
|
||||
QVERIFY(m_coreController->m_allowedDnsModel->rowCount() == 1, "AllowedDnsModel should have 1 row");
|
||||
QVERIFY2(errorOccurredSpy.count() == 0, "errorOccurred signal should not be emitted");
|
||||
QVERIFY2(finishedSpy.count() == 1, "finished signal should be emitted");
|
||||
QVERIFY2(m_coreController->m_allowedDnsModel->rowCount() == 1, "AllowedDnsModel should have 1 row");
|
||||
|
||||
QModelIndex allowedDnsModelIndex = m_coreController->m_allowedDnsModel->index(0, 0);
|
||||
QVERIFY2(allowedDnsModelIndex.isValid(), "Site model index should be valid");
|
||||
|
||||
auto dnsIp = m_coreController->m_allowedDnsModel->data(allowedDnsModelIndex, AllowedDnsModel::IpRole);
|
||||
QVERIFY(dnsIp == ip, QString("app path should be %1, got %2").arg(ip, appPath));
|
||||
QVERIFY2(dnsIp == ip, QString("app path should be %1, got %2").arg(ip, appPath));
|
||||
|
||||
m_coreController->m_allowedDnsUiController->importDns(getPath(), true);
|
||||
m_coreController->m_allowedDnsUiController->updateModel();
|
||||
QVERIFY(errorOccurredSpy.count() == 0, "errorOccurred signal should not be emitted");
|
||||
QVERIFY(finishedSpy.count() == 2, "finished signal should be emitted");
|
||||
QVERIFY(m_coreController->m_allowedDnsModel->rowCount() > 1, "AllowedDnsModel should have more than 1 row");
|
||||
QVERIFY2(errorOccurredSpy.count() == 0, "errorOccurred signal should not be emitted");
|
||||
QVERIFY2(finishedSpy.count() == 2, "finished signal should be emitted");
|
||||
QVERIFY2(m_coreController->m_allowedDnsModel->rowCount() > 1, "AllowedDnsModel should have more than 1 row");
|
||||
|
||||
m_coreController->m_allowedDnsUiController->exportDns(getExportPath() + "test_dns_export.json");
|
||||
QVERIFY(errorOccurredSpy.count() == 0, "errorOccurred signal should not be emitted");
|
||||
QVERIFY(finishedSpy.count() == 3, "finished signal should be emitted");
|
||||
QVERIFY2(errorOccurredSpy.count() == 0, "errorOccurred signal should not be emitted");
|
||||
QVERIFY2(finishedSpy.count() == 3, "finished signal should be emitted");
|
||||
|
||||
m_coreController->m_allowedDnsUiController->removeDns(0);
|
||||
m_coreController->m_allowedDnsUiController->updateModel();
|
||||
QVERIFY(errorOccurredSpy.count() == 0, "errorOccurred signal should not be emitted");
|
||||
QVERIFY(finishedSpy.count() == 4, "finished signal should be emitted");
|
||||
QVERIFY(m_coreController->m_allowedDnsModel->rowCount() == 0, "AllowedDnsModel should have 0 rows");
|
||||
QVERIFY2(errorOccurredSpy.count() == 0, "errorOccurred signal should not be emitted");
|
||||
QVERIFY2(finishedSpy.count() == 4, "finished signal should be emitted");
|
||||
QVERIFY2(m_coreController->m_allowedDnsModel->rowCount() == 0, "AllowedDnsModel should have 0 rows");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -65,41 +65,41 @@ private slots:
|
||||
QSignalSpy isSplitTunnelingChangedSpy(m_coreController->m_appSplitTunnelingUiController, &AppSplitTunnelingUiController::isTunnelingEnabledChanged);
|
||||
|
||||
m_coreController->m_appSplitTunnelingUiController->toggleSplitTunneling(true);
|
||||
QVERIFY(isSplitTunnelingChangedSpy.count() == 1, "isSplitTunnelingChangedSpy signal should be emitted");
|
||||
QVERIFY(m_coreController->m_appSplitTunnelingUiController->isTunnelingEnabled() == true, "AppSplitTunneling should be enabled");
|
||||
QVERIFY2(isSplitTunnelingChangedSpy.count() == 1, "isSplitTunnelingChangedSpy signal should be emitted");
|
||||
QVERIFY2(m_coreController->m_appSplitTunnelingUiController->isTunnelingEnabled() == true, "AppSplitTunneling should be enabled");
|
||||
|
||||
m_coreController->m_appSplitTunnelingUiController->toggleSplitTunneling(false);
|
||||
QVERIFY(isSplitTunnelingChangedSpy.count() == 2, "isSplitTunnelingChangedSpy signal should be emitted 2nd time");
|
||||
QVERIFY(m_coreController->m_appSplitTunnelingUiController->isTunnelingEnabled() == false, "AppSplitTunneling should be disabled");
|
||||
QVERIFY2(isSplitTunnelingChangedSpy.count() == 2, "isSplitTunnelingChangedSpy signal should be emitted 2nd time");
|
||||
QVERIFY2(m_coreController->m_appSplitTunnelingUiController->isTunnelingEnabled() == false, "AppSplitTunneling should be disabled");
|
||||
|
||||
QString app = getPath();
|
||||
|
||||
m_coreController->m_appSplitTunnelingUiController->addApp(app);
|
||||
m_coreController->m_appSplitTunnelingUiController->updateModel();
|
||||
QVERIFY(finishedSpy.count() == 1, "finished signal should be emitted");
|
||||
QVERIFY(m_coreController->m_appSplitTunnelingModel->rowCount() == 1, "AppSplitTunnelingModel should have 1 row");
|
||||
QVERIFY2(finishedSpy.count() == 1, "finished signal should be emitted");
|
||||
QVERIFY2(m_coreController->m_appSplitTunnelingModel->rowCount() == 1, "AppSplitTunnelingModel should have 1 row");
|
||||
|
||||
QModelIndex appSTModelIndex = m_coreController->m_appSplitTunnelingModel->index(0, 0);
|
||||
QVERIFY2(appSTModelIndex.isValid(), "Site model index should be valid");
|
||||
|
||||
auto appPath = m_coreController->m_appSplitTunnelingModel->data(appSTModelIndex, AppSplitTunnelingModel::AppPathRole);
|
||||
QVERIFY(app.contains(appPath.toString()) == true, QString("app path should be %1, got %2").arg(app, appPath));
|
||||
QVERIFY2(app.contains(appPath.toString()) == true, QString("app path should be %1, got %2").arg(app, appPath));
|
||||
|
||||
auto pkgAppName = m_coreController->m_appSplitTunnelingModel->data(appSTModelIndex, AppSplitTunnelingModel::PackageAppNameRole);
|
||||
QVERIFY(pkgAppName == true, "app name should be set");
|
||||
QVERIFY2(pkgAppName == true, "app name should be set");
|
||||
|
||||
auto pkgAppIcon = m_coreController->m_appSplitTunnelingModel->data(appSTModelIndex, AppSplitTunnelingModel::PackageAppIconRole);
|
||||
QVERIFY(pkgAppIcon == true, "app image should be set");
|
||||
QVERIFY2(pkgAppIcon == true, "app image should be set");
|
||||
|
||||
m_coreController->m_appSplitTunnelingUiController->addApp(app);
|
||||
m_coreController->m_appSplitTunnelingUiController->updateModel();
|
||||
QVERIFY(errorOccurredSpy.count() == 1, "errorOccurred signal should be emitted");
|
||||
QVERIFY(m_coreController->m_appSplitTunnelingModel->rowCount() == 1, "AppSplitTunnelingModel should have 3 rows (same app should not be added)");
|
||||
QVERIFY2(errorOccurredSpy.count() == 1, "errorOccurred signal should be emitted");
|
||||
QVERIFY2(m_coreController->m_appSplitTunnelingModel->rowCount() == 1, "AppSplitTunnelingModel should have 3 rows (same app should not be added)");
|
||||
|
||||
m_coreController->m_appSplitTunnelingUiController->removeApp(0);
|
||||
m_coreController->m_appSplitTunnelingUiController->updateModel();
|
||||
QVERIFY(finishedSpy.count() == 2, "finished signal should be emitted");
|
||||
QVERIFY(m_coreController->m_appSplitTunnelingModel->rowCount() == 0, "AppSplitTunnelingModel should have 0 rows");
|
||||
QVERIFY2(finishedSpy.count() == 2, "finished signal should be emitted");
|
||||
QVERIFY2(m_coreController->m_appSplitTunnelingModel->rowCount() == 0, "AppSplitTunnelingModel should have 0 rows");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -54,18 +54,18 @@ private slots:
|
||||
|
||||
void testChangeLanguage()
|
||||
{
|
||||
QVERIFY(m_coreController->m_languageModel->rowCount() > 0, "Language model should not be empty");
|
||||
QVERIFY2(m_coreController->m_languageModel->rowCount() > 0, "Language model should not be empty");
|
||||
|
||||
QSignalSpy updateTranslationsSpy(m_coreController->m_languageUiController, &LanguageUiController::updateTranslations);
|
||||
QSignalSpy translationsUpdatedSpy(m_coreController->m_languageUiController, &LanguageUiController::translationsUpdated);
|
||||
|
||||
m_coreController->m_languageUiController->changeLanguage(LanguageSettings::AvailableLanguageEnum::China_cn);
|
||||
QVERIFY(updateTranslationsSpy.count() == 1, "updateTranslations signal should be emitted");
|
||||
QVERIFY(translationsUpdatedSpy.count() == 1, "translationsUpdated signal should be emitted");
|
||||
QVERIFY2(updateTranslationsSpy.count() == 1, "updateTranslations signal should be emitted");
|
||||
QVERIFY2(translationsUpdatedSpy.count() == 1, "translationsUpdated signal should be emitted");
|
||||
|
||||
m_coreController->m_languageUiController->changeLanguage(LanguageSettings::AvailableLanguageEnum::English);
|
||||
QVERIFY(updateTranslationsSpy.count() == 2, "updateTranslations signal should be emitted");
|
||||
QVERIFY(translationsUpdatedSpy.count() == 2, "translationsUpdated signal should be emitted");
|
||||
QVERIFY2(updateTranslationsSpy.count() == 2, "updateTranslations signal should be emitted");
|
||||
QVERIFY2(translationsUpdatedSpy.count() == 2, "translationsUpdated signal should be emitted");
|
||||
}
|
||||
|
||||
void testUrl()
|
||||
@@ -78,17 +78,17 @@ private slots:
|
||||
QString siteEN = m_coreController->m_languageUiController->getCurrentSiteUrl("test_path");
|
||||
QString docsEN = m_coreController->m_languageUiController->getCurrentDocsUrl("test_path");
|
||||
|
||||
QVERIFY(siteRU != siteEN, "site url's should not be same");
|
||||
QVERIFY(docsRU != docsEN, "docs url's should not be same");
|
||||
QVERIFY2(siteRU != siteEN, "site url's should not be same");
|
||||
QVERIFY2(docsRU != docsEN, "docs url's should not be same");
|
||||
}
|
||||
|
||||
void testLineHeight()
|
||||
{
|
||||
m_coreController->m_languageUiController->changeLanguage(LanguageSettings::AvailableLanguageEnum::Burmese);
|
||||
QVERIFY(m_coreController->m_languageUiController->getLineHeightAppend() == 10, "line height should be 10");
|
||||
QVERIFY2(m_coreController->m_languageUiController->getLineHeightAppend() == 10, "line height should be 10");
|
||||
|
||||
m_coreController->m_languageUiController->changeLanguage(LanguageSettings::AvailableLanguageEnum::English);
|
||||
QVERIFY(m_coreController->m_languageUiController->getLineHeightAppend() == 0, "line height should be 0");
|
||||
QVERIFY2(m_coreController->m_languageUiController->getLineHeightAppend() == 0, "line height should be 0");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -81,20 +81,20 @@ private slots:
|
||||
QSignalSpy isSplitTunnelingChangedSpy(m_coreController->m_sitesUiController, &SitesUiController::isTunnelingEnabledChanged);
|
||||
|
||||
m_coreController->m_sitesUiController->toggleSplitTunneling(true);
|
||||
QVERIFY(isSplitTunnelingChangedSpy.count() == 1, "isSplitTunnelingChangedSpy signal should be emitted");
|
||||
QVERIFY(m_coreController->m_sitesUiController->isTunnelingEnabled() == true, "SiteSplitTunneling should be enabled");
|
||||
QVERIFY2(isSplitTunnelingChangedSpy.count() == 1, "isSplitTunnelingChangedSpy signal should be emitted");
|
||||
QVERIFY2(m_coreController->m_sitesUiController->isTunnelingEnabled() == true, "SiteSplitTunneling should be enabled");
|
||||
|
||||
m_coreController->m_sitesUiController->toggleSplitTunneling(false);
|
||||
QVERIFY(isSplitTunnelingChangedSpy.count() == 2, "isSplitTunnelingChangedSpy signal should be emitted 2nd time");
|
||||
QVERIFY(m_coreController->m_sitesUiController->isTunnelingEnabled() == false, "SiteSplitTunneling should be disabled");
|
||||
QVERIFY2(isSplitTunnelingChangedSpy.count() == 2, "isSplitTunnelingChangedSpy signal should be emitted 2nd time");
|
||||
QVERIFY2(m_coreController->m_sitesUiController->isTunnelingEnabled() == false, "SiteSplitTunneling should be disabled");
|
||||
|
||||
QString site = "2ip.io";
|
||||
|
||||
m_coreController->m_sitesUiController->addSite(site);
|
||||
m_coreController->m_sitesUiController->addSite("whatismyipaddress.com");
|
||||
m_coreController->m_sitesUiController->updateModel();
|
||||
QVERIFY(finishedSpy.count() == 2, "finished signal should be emitted 2 times");
|
||||
QVERIFY(m_coreController->m_sitesModel->rowCount() == 2, "SitesModel should have 2 rows");
|
||||
QVERIFY2(finishedSpy.count() == 2, "finished signal should be emitted 2 times");
|
||||
QVERIFY2(m_coreController->m_sitesModel->rowCount() == 2, "SitesModel should have 2 rows");
|
||||
|
||||
QModelIndex siteModelIndex = m_coreController->m_sitesModel->index(0, 0);
|
||||
QVERIFY2(siteModelIndex.isValid(), "Site model index should be valid");
|
||||
@@ -103,26 +103,26 @@ private slots:
|
||||
QCOMPARE(siteUrl, normalizeHostname(site));
|
||||
|
||||
auto siteIp = m_coreController->m_sitesModel->data(siteModelIndex, SitesModel::IpRole);
|
||||
QVERIFY(siteIp.isNull() == false, "site ip should not be empty");
|
||||
QVERIFY2(siteIp.isNull() == false, "site ip should not be empty");
|
||||
|
||||
m_coreController->m_sitesUiController->removeSite(0);
|
||||
m_coreController->m_sitesUiController->updateModel();
|
||||
QVERIFY(finishedSpy.count() == 3, "finished signal should be emitted");
|
||||
QVERIFY(m_coreController->m_sitesModel->rowCount() == 1, "SitesModel should have 1 row");
|
||||
QVERIFY2(finishedSpy.count() == 3, "finished signal should be emitted");
|
||||
QVERIFY2(m_coreController->m_sitesModel->rowCount() == 1, "SitesModel should have 1 row");
|
||||
|
||||
m_coreController->m_sitesUiController->importSites(getPath(), true);
|
||||
m_coreController->m_sitesUiController->updateModel();
|
||||
QVERIFY(errorOccurredSpy.count() == 0, "errorOccurred signal should not be emitted");
|
||||
QVERIFY(finishedSpy.count() == 4, "finished signal should be emitted");
|
||||
QVERIFY(m_coreController->m_sitesModel->rowCount() > 1, "SitesModel should have more than 1 row");
|
||||
QVERIFY2(errorOccurredSpy.count() == 0, "errorOccurred signal should not be emitted");
|
||||
QVERIFY2(finishedSpy.count() == 4, "finished signal should be emitted");
|
||||
QVERIFY2(m_coreController->m_sitesModel->rowCount() > 1, "SitesModel should have more than 1 row");
|
||||
|
||||
m_coreController->m_sitesUiController->exportSites(getExportPath() + "test_sites_export.json");
|
||||
QVERIFY(finishedSpy.count() == 5, "finished signal should be emitted");
|
||||
QVERIFY2(finishedSpy.count() == 5, "finished signal should be emitted");
|
||||
|
||||
m_coreController->m_sitesUiController->removeSites();
|
||||
m_coreController->m_sitesUiController->updateModel();
|
||||
QVERIFY(finishedSpy.count() == 6, "finished signal should be emitted");
|
||||
QVERIFY(m_coreController->m_sitesModel->rowCount() == 0, "SitesModel should have 0 rows");
|
||||
QVERIFY2(finishedSpy.count() == 6, "finished signal should be emitted");
|
||||
QVERIFY2(m_coreController->m_sitesModel->rowCount() == 0, "SitesModel should have 0 rows");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user