diff --git a/src/modules/contextualprocess/ContextualProcessJob.cpp b/src/modules/contextualprocess/ContextualProcessJob.cpp index b0d7a6743..1173a3071 100644 --- a/src/modules/contextualprocess/ContextualProcessJob.cpp +++ b/src/modules/contextualprocess/ContextualProcessJob.cpp @@ -77,7 +77,7 @@ fetch( QString& value, QStringList& selector, int index, const QVariant& v ) } const QVariantMap map = v.toMap(); const QString& key = selector.at( index ); - if ( index == selector.length() ) + if ( index == selector.length() - 1) { value = map.value( key ).toString(); return map.contains( key ); diff --git a/src/modules/contextualprocess/Tests.cpp b/src/modules/contextualprocess/Tests.cpp index 8f3322455..a0071328a 100644 --- a/src/modules/contextualprocess/Tests.cpp +++ b/src/modules/contextualprocess/Tests.cpp @@ -88,6 +88,8 @@ ContextualProcessTests::testProcessListSampleConfig() void ContextualProcessTests::testFetch() { + Logger::setupLogLevel( Logger::LOGVERBOSE ); + QVariantMap m; // Some keys without sub-map m.insert( QStringLiteral( "carrot" ), true ); @@ -150,7 +152,7 @@ void ContextualProcessTests::testFetch() ContextualProcessBinding b( QStringLiteral( "berries" ) ); QString s; QVERIFY( b.fetch( gs, s ) ); - QVERIFY( s.contains( QStringLiteral( "QVariant" ) ) ); + QVERIFY( s.isEmpty() ); // No string representation } { // Compound lookup