massive changes inside

* use pass by ref instead of by value if possible
* use reference in interation over collections
* fix no tag inserting
This commit is contained in:
2017-05-04 15:00:50 +03:00
parent 6e99e262d4
commit 6e62ceaac7
119 changed files with 645 additions and 634 deletions

View File

@ -43,14 +43,14 @@ void TestAWBugReporter::test_generateText()
QString output
= plugin->generateText(data.at(0), data.at(1), data.at(2), data.at(3));
for (auto string : data)
for (auto &string : data)
QVERIFY(output.contains(string));
}
void TestAWBugReporter::test_sendBugReport()
{
QSignalSpy spy(plugin, SIGNAL(replyReceived(int, QString)));
QSignalSpy spy(plugin, SIGNAL(replyReceived(int, QString &)));
plugin->sendBugReport(
AWTestLibrary::randomString(),
plugin->generateText(data.at(0), data.at(1), data.at(2), data.at(3)));

View File

@ -46,7 +46,7 @@ void TestAWConfigHelper::test_configurationDirectory()
void TestAWConfigHelper::test_exportConfiguration()
{
QStringList keys = AWTestLibrary::randomStringList();
for (auto key : keys)
for (auto &key : keys)
map[key] = AWTestLibrary::randomString();
filename = AWTestLibrary::randomFilenames().first;
@ -59,7 +59,7 @@ void TestAWConfigHelper::test_importConfiguration()
QVariantMap imported
= plugin->importConfiguration(filename, true, true, true);
QVariantMap converted;
for (auto key : map.keys())
for (auto &key : map.keys())
converted[key] = map.value(key);
QCOMPARE(imported, converted);

View File

@ -106,7 +106,7 @@ void TestAWKeys::test_pattern()
QEXPECT_FAIL("", "Pattern should be parsed", Continue);
QCOMPARE(text, pattern);
QStringList keys = plugin->dictKeys(true);
for (auto key : keys)
for (auto &key : keys)
QVERIFY(!text.contains(key));
}
@ -143,7 +143,7 @@ void TestAWKeys::test_infoByKey()
{
int notEmpty = 0;
QStringList keys = plugin->dictKeys(true);
for (auto key : keys) {
for (auto &key : keys) {
QString info = plugin->infoByKey(key);
QVERIFY(!info.isEmpty());
// append non-empty field count
@ -158,7 +158,7 @@ void TestAWKeys::test_valueByKey()
{
int notEmpty = 0;
QStringList keys = plugin->dictKeys(true);
for (auto key : keys) {
for (auto &key : keys) {
if (!plugin->valueByKey(key).isEmpty())
notEmpty++;
}

View File

@ -64,7 +64,7 @@ void TestAWTelemetryHandler::test_getLast()
void TestAWTelemetryHandler::test_uploadTelemetry()
{
QSignalSpy spy(plugin, SIGNAL(replyReceived(QString)));
QSignalSpy spy(plugin, SIGNAL(replyReceived(QString &)));
plugin->uploadTelemetry(telemetryValidGroup, telemetryData);
QVERIFY(spy.wait(5000));

View File

@ -93,7 +93,7 @@ void TestDPPlugin::test_parsePattern()
QString result = plugin->parsePattern(pattern, plugin->currentDesktop());
QVERIFY(!result.isEmpty());
QVERIFY(result != pattern);
for (auto key : plugin->dictKeys())
for (auto &key : plugin->dictKeys())
QVERIFY(!result.contains(key));
}

View File

@ -62,7 +62,7 @@ void TestExtQuotes::test_run()
for (auto &type : types)
cache[type] = arguments.at(0).toHash()[extQuotes->tag(type)];
for (auto type : types) {
for (auto &type : types) {
QCOMPARE(firstValue[extQuotes->tag(type)].toDouble(), 0.0);
QVERIFY((cache[type].toDouble() > price.first)
&& (cache[type].toDouble() < price.second));
@ -80,10 +80,10 @@ void TestExtQuotes::test_derivatives()
QVERIFY(spy.wait(5000));
QList<QVariant> arguments = spy.takeFirst();
QVariantHash values;
for (auto type : types)
for (auto &type : types)
values[type] = arguments.at(0).toHash()[extQuotes->tag(type)];
for (auto type : types) {
for (auto &type : types) {
QCOMPARE(arguments.at(0)
.toHash()[extQuotes->tag(QString("%1chg").arg(type))]
.toDouble(),