Changeset View
Changeset View
Standalone View
Standalone View
autotests/propertyinfotest.cpp
Show All 39 Lines | 34 | for (; i <= e; i++) { | |||
---|---|---|---|---|---|
40 | QVERIFY(!pi.name().isEmpty()); | 40 | QVERIFY(!pi.name().isEmpty()); | ||
41 | QVERIFY(!pi.displayName().isEmpty()); | 41 | QVERIFY(!pi.displayName().isEmpty()); | ||
42 | 42 | | |||
43 | PropertyInfo pi2 = PropertyInfo::fromName(pi.name()); | 43 | PropertyInfo pi2 = PropertyInfo::fromName(pi.name()); | ||
44 | QCOMPARE(pi2.property(), p); | 44 | QCOMPARE(pi2.property(), p); | ||
45 | } | 45 | } | ||
46 | } | 46 | } | ||
47 | 47 | | |||
48 | void PropertyInfoTest::testFormatAsDisplayString() | ||||
49 | { | ||||
50 | auto emptyProperty = PropertyInfo::fromName(QStringLiteral("no valid property name")); | ||||
51 | QCOMPARE(emptyProperty.formatAsDisplayString(QVariant("empty")), QStringLiteral("empty")); | ||||
52 | PropertyInfo year(Property::DiscNumber); | ||||
53 | QCOMPARE(year.formatAsDisplayString(QVariant(2018)), QStringLiteral("2018")); | ||||
54 | QStringList artistList = {"Artist1", "Artist2"}; | ||||
55 | PropertyInfo artist(Property::Artist); | ||||
56 | QCOMPARE(artist.formatAsDisplayString(QVariant(artistList)), QStringLiteral("Artist1, Artist2")); | ||||
57 | QStringList authorList = {"Author1"}; | ||||
58 | PropertyInfo author(Property::Author); | ||||
59 | QCOMPARE(artist.formatAsDisplayString(QVariant(authorList)), QStringLiteral("Author1")); | ||||
60 | PropertyInfo duration(Property::Duration); | ||||
61 | QCOMPARE(duration.formatAsDisplayString(QVariant(1800)), QStringLiteral("0:30:00")); | ||||
62 | PropertyInfo sampleRate(Property::SampleRate); | ||||
63 | QCOMPARE(sampleRate.formatAsDisplayString(QVariant(44100)), QStringLiteral("44,1 kHz")); | ||||
bruns: I think this should be "44.1 kHz". Insert the correct expected value and make it QEXPECT_FAIL? | |||||
astippich: That was a localization issue. | |||||
64 | PropertyInfo bitRate(Property::BitRate); | ||||
65 | QCOMPARE(bitRate.formatAsDisplayString(QVariant(128000)), QStringLiteral("128 kB/s")); | ||||
bruns: dito, "128 kb/s" | |||||
astippich: I'm going to fix this shortly after, so I don't bother | |||||
66 | PropertyInfo orientation(Property::ImageOrientation); | ||||
67 | QCOMPARE(orientation.formatAsDisplayString(QVariant(5)), QStringLiteral("Transposed")); | ||||
68 | } | ||||
69 | | ||||
48 | QTEST_GUILESS_MAIN(PropertyInfoTest) | 70 | QTEST_GUILESS_MAIN(PropertyInfoTest) |
I think this should be "44.1 kHz". Insert the correct expected value and make it QEXPECT_FAIL?