Esempio n. 1
0
/*!
    Compares a media resource to \a other.

    Returns true if the resources are identical, and false otherwise.
    \since 1.0
*/
bool QMediaResource::operator ==(const QMediaResource &other) const
{
    // Compare requests directly as QNetworkRequests are "custom types".
    foreach (int key, values.keys()) {
        switch (key) {
        case Request:
            if (request() != other.request())
                return false;
        break;
        default:
            if (values.value(key) != other.values.value(key))
                return false;
        }
    }
    return true;
}
void tst_QMediaResource::constructNull()
{
    QMediaResource resource;

    QCOMPARE(resource.isNull(), true);
    QCOMPARE(resource.url(), QUrl());
    QCOMPARE(resource.request(), QNetworkRequest());
    QCOMPARE(resource.mimeType(), QString());
    QCOMPARE(resource.language(), QString());
    QCOMPARE(resource.audioCodec(), QString());
    QCOMPARE(resource.videoCodec(), QString());
    QCOMPARE(resource.dataSize(), qint64(0));
    QCOMPARE(resource.audioBitRate(), 0);
    QCOMPARE(resource.sampleRate(), 0);
    QCOMPARE(resource.channelCount(), 0);
    QCOMPARE(resource.videoBitRate(), 0);
    QCOMPARE(resource.resolution(), QSize());
}