D15714: add a string suffix to test data and use for unicode testing of taglibwriter

Stefan Brüns noreply at phabricator.kde.org
Tue Sep 25 23:35:08 BST 2018


bruns added inline comments.

INLINE COMMENTS

> taglibwritertest.cpp:60
>  
> -    QCOMPARE(extractedTitle, QStringLiteral("Title1"));
> -    QCOMPARE(extractedArtist, QStringLiteral("Artist1"));
> -    QCOMPARE(extractedAlbum, QStringLiteral("Album1"));
> +    QCOMPARE(extractedTitle, QString(QStringLiteral("Title1") + stringSuffix.toUtf8()));
> +    QCOMPARE(extractedArtist, QString(QStringLiteral("Artist1") + stringSuffix.toUtf8()));

I don't think it is a good idea to do a `stringSuffix.toUtf8().fromUtf8()` round trip here for each test case and for each tag.

> taglibwritertest.cpp:73
>  {
> +    QString unicodeTestStringSuffix = QStringLiteral("€");
>      QTest::addColumn<QString>("fileType");

If safeguarding against bad editors is really necessary, better do it here.
Alternatively, you can use C++11 unicode string literals, e.g.
`QString(u"€")`
If you save that one as e.g. latin1 and try to compile it, gcc reports:

  error: converting to execution character set: Invalid or incomplete multibyte or wide character
       QString a{u"�"};

REPOSITORY
  R286 KFileMetaData

REVISION DETAIL
  https://phabricator.kde.org/D15714

To: astippich, mgallien, bruns
Cc: smithjd, svuorela, kde-frameworks-devel, #baloo, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180925/ac9fc7e4/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list