D10149: baloo-widgets: Add autotest for asychronously extracted data
Elvis Angelaccio
noreply at phabricator.kde.org
Sat Feb 10 20:43:04 GMT 2018
elvisangelaccio requested changes to this revision.
elvisangelaccio added inline comments.
This revision now requires changes to proceed.
INLINE COMMENTS
> filemetadatawidgettest.cpp:40
> qRegisterMetaType<KFileItemList>("KFileItemList");
> + QString exe = QStandardPaths::findExecutable(QLatin1String("setfattr"));
> +
Please make this variable `const`. Also, use `QStringLiteral` (`QLatin1String` should be used only when there is a specific overload for it).
> filemetadatawidgettest.cpp:46-51
> + QStringList args;
> + args << QStringLiteral("--name=user.baloo.rating")
> + << QStringLiteral("--value=5")
> + << QStringLiteral("%1/testtagged.mp3").arg(TESTS_SAMPLE_FILES_PATH)
> + << QStringLiteral("%1/testtagged.m4a").arg(TESTS_SAMPLE_FILES_PATH)
> + ;
We can use the new C++11 syntax here:
const QStringList args = { QStringLiteral("foo"), QStringLiteral("bar"), ... };
> filemetadatawidgettest.cpp:59
> +
> + if (process.exitStatus() == QProcess::NormalExit) {
> + m_mayTestRating = true;
remove one space after the `==`
> filemetadatawidgettest.cpp:118-132
> +const QMap<QString, QString>* collectData(const QWidget* widget, int skip)
> +{
> + QMap<QString, QString>* map(new QMap<QString, QString>());
> + QList<QWidget *> list = widget->findChildren<QWidget *>(QString(), Qt::FindDirectChildrenOnly);
> + // Skip the first few widgets: unusable duplicates of tags, comment and rating.
> + for( int i=skip; i<list.count() - 1; i+=2 ) {
> + map->insert(list[i]->property("text").toString()
I think we should give a name to the widgets that we actually want to test (only 3 currently, right?), using `setObjectName()` on them in `filemetadatawidget.cpp`
This way we can just find them here with a simple `findChildren()`.
REPOSITORY
R824 Baloo Widgets
REVISION DETAIL
https://phabricator.kde.org/D10149
To: michaelh, #dolphin, elvisangelaccio
Cc: ngraham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20180210/d167d043/attachment.htm>
More information about the kfm-devel
mailing list