ExtensionManager: Let QtC developer test data sets explicitly

The extansion query service is currently only reachable from within the
internal network. So far, if the request failed, and if Qt Creator was
configured with WITH_TESTS, a set of test json got loaded.

That test data confuses people in the team.

This change makes loading of test data explicit, and comments it off by
default.

Change-Id: I89236064b6af32be7559bb6d36cbf0d42982085d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alessandro Portale
2024-06-26 08:07:09 +02:00
parent aefc50f1de
commit 62e37eec42

View File

@@ -362,6 +362,12 @@ int ExtensionsBrowser::extraListViewWidth() const
void ExtensionsBrowser::fetchExtensions() void ExtensionsBrowser::fetchExtensions()
{ {
#ifdef WITH_TESTS
// Uncomment for testing with local json data.
// Available: "augmentedplugindata", "defaultpacks", "varieddata", "thirdpartyplugins"
// d->model->setExtensionsJson(testData("defaultpacks")); return;
#endif // WITH_TESTS
using namespace Tasking; using namespace Tasking;
const auto onQuerySetup = [](NetworkQuery &query) { const auto onQuerySetup = [](NetworkQuery &query) {
@@ -379,13 +385,6 @@ void ExtensionsBrowser::fetchExtensions()
query.setNetworkAccessManager(NetworkAccessManager::instance()); query.setNetworkAccessManager(NetworkAccessManager::instance());
}; };
const auto onQueryDone = [this](const NetworkQuery &query, DoneWith result) { const auto onQueryDone = [this](const NetworkQuery &query, DoneWith result) {
if (result != DoneWith::Success) {
#ifdef WITH_TESTS
// Available: "augmentedplugindata", "defaultpacks", "varieddata", "thirdpartyplugins"
d->model->setExtensionsJson(testData("defaultpacks"));
#endif // WITH_TESTS
return;
}
const QByteArray response = query.reply()->readAll(); const QByteArray response = query.reply()->readAll();
d->model->setExtensionsJson(response); d->model->setExtensionsJson(response);
}; };