Пример #1
0
void ut_metadata::testEditCity()
{
    QTemporaryFile file;
    file.open();
    sourceImage.save(file.fileName(), "jpg");
    QuillMetadata empty;
    empty.setEntry(QuillMetadata::Tag_City, QString("Tapiola"));
    empty.write(file.fileName());

    QuillMetadata writtenMetadata(file.fileName());
    QVERIFY(writtenMetadata.isValid());
    QCOMPARE(writtenMetadata.entry(QuillMetadata::Tag_City).toString(),
             QString("Tapiola"));
}
Пример #2
0
void ut_metadata::testEditOrientation()
{
    QTemporaryFile file;
    file.open();
    sourceImage.save(file.fileName(), "jpg");
    QuillMetadata empty;
    empty.setEntry(QuillMetadata::Tag_Orientation, QVariant(7));
    QVERIFY(empty.write(file.fileName()));

    QuillMetadata writtenMetadata(file.fileName());
    QVERIFY(writtenMetadata.isValid());
    QCOMPARE(writtenMetadata.entry(QuillMetadata::Tag_Orientation).toString(),
             QString("7"));
}
Пример #3
0
void ut_metadata::testEditTitle()
{
    QTemporaryFile file;
    file.open();
    sourceImage.save(file.fileName(), "jpg");
    QuillMetadata empty;
    empty.setEntry(QuillMetadata::Tag_Title,
                   QString("The Big Fish"));
    QVERIFY(empty.write(file.fileName()));

    QuillMetadata writtenMetadata(file.fileName());
    QVERIFY(writtenMetadata.isValid());

    QCOMPARE(writtenMetadata.entry(QuillMetadata::Tag_Title).toString(),
             QString("The Big Fish"));
}
Пример #4
0
void ut_metadata::testEditKeywords()
{
    QTemporaryFile file;
    file.open();
    sourceImage.save(file.fileName(), "jpg");
    QuillMetadata empty;
    QStringList list;
    list << "aquarium" << "Neon Tetra" << "Paracheirodon innesi";

    empty.setEntry(QuillMetadata::Tag_Subject, list);
    empty.write(file.fileName());

    QuillMetadata writtenMetadata(file.fileName());
    QVERIFY(writtenMetadata.isValid());

    QStringList resultList =
        writtenMetadata.entry(QuillMetadata::Tag_Subject).toStringList();
    QCOMPARE(resultList, list);
}
Пример #5
0
void ut_load::testExifRotationSizePeek()
{
    QTemporaryFile testFile;
    testFile.open();

    QImage image("/usr/share/quillimagefilter-tests/images/16_color_palette.png");
    image.save(testFile.fileName(), "jpeg");

    QuillMetadata metadata;
    metadata.setEntry(QuillMetadata::Tag_Orientation, QVariant(6));
    metadata.write(testFile.fileName());

    QuillImageFilter *filter =
        QuillImageFilterFactory::createImageFilter("org.maemo.load");

    filter->setOption(QuillImageFilter::FileName, QString(testFile.fileName()));
    QCOMPARE(filter->newFullImageSize(QSize()), QSize(2, 8));

    delete filter;
}
Пример #6
0
void ut_metadata::testOrientationTagSpeedup()
{
    QString str("/usr/share/quillimagefilter-tests/images/16_color_palette.png");

    for (int i = 0; i<=8; i++){
        QTemporaryFile file;
        file.open();
        sourceImage.save(file.fileName(), "jpg");

        QuillMetadata empty;
        empty.setEntry(QuillMetadata::Tag_Orientation, QVariant(i));
        QVERIFY(empty.write(file.fileName()));

        int orientation1, orientation2;
        {
            QuillMetadata *metadata = new QuillMetadata(file.fileName(),
                                                        QuillMetadata::ExifFormat);
            QVERIFY(metadata->isValid());
            QCOMPARE(metadata->entry(QuillMetadata::Tag_Orientation).toInt(), i);

            orientation1 = metadata->entry(QuillMetadata::Tag_Orientation).toInt();

            delete metadata;
        }
        {
            QuillMetadata *metadata = new QuillMetadata(file.fileName(),
                                                        QuillMetadata::ExifFormat,
                                                        QuillMetadata::Tag_Orientation);
            QVERIFY(metadata->isValid());
            QCOMPARE(metadata->entry(QuillMetadata::Tag_Orientation).toInt(), i);
            orientation2 = metadata->entry(QuillMetadata::Tag_Orientation).toInt();

            delete metadata;
        }
        QCOMPARE(orientation1, orientation2);
    }
}