Add back history view cover photos
This commit is contained in:
11 files changed
+476
-28
No files matched your search
@@ -0,0 +1,60 @@
|
||||
#include <QtTest/QtTest>
|
||||
#include <QApplication>
|
||||
#include <QImage>
|
||||
#include <QSize>
|
||||
|
||||
#include "backend/formats/FileIconProvider.h"
|
||||
|
||||
class FileIconProviderTest : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void requestImageReturnsValidImageForExistingFile()
|
||||
{
|
||||
FileIconProvider provider;
|
||||
QSize size;
|
||||
// Use a known fixture file
|
||||
const QString path = QStringLiteral(FIXTURES_DIR) + "/sample.txt";
|
||||
QImage image = provider.requestImage(path, &size, QSize());
|
||||
|
||||
QVERIFY(!image.isNull());
|
||||
QVERIFY(size.width() > 0);
|
||||
QVERIFY(size.height() > 0);
|
||||
}
|
||||
|
||||
void requestImageReturnsValidImageForNonexistentFile()
|
||||
{
|
||||
FileIconProvider provider;
|
||||
QSize size;
|
||||
// QFileIconProvider returns a generic icon even for missing files
|
||||
QImage image = provider.requestImage(
|
||||
QStringLiteral("/tmp/nonexistent_asteria_test.epub"), &size, QSize());
|
||||
|
||||
QVERIFY(!image.isNull());
|
||||
}
|
||||
|
||||
void requestImageHonorsRequestedSize()
|
||||
{
|
||||
FileIconProvider provider;
|
||||
QSize size;
|
||||
const QSize requested(32, 32);
|
||||
const QString path = QStringLiteral(FIXTURES_DIR) + "/sample.txt";
|
||||
QImage image = provider.requestImage(path, &size, requested);
|
||||
|
||||
QVERIFY(!image.isNull());
|
||||
// Icon pixmaps may be slightly different sizes depending on the platform,
|
||||
// but should be non-empty and at most the requested size.
|
||||
QVERIFY(image.width() > 0);
|
||||
QVERIFY(image.height() > 0);
|
||||
}
|
||||
};
|
||||
|
||||
// QFileIconProvider requires QApplication (not just QCoreApplication)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
FileIconProviderTest test;
|
||||
return QTest::qExec(&test, argc, argv);
|
||||
}
|
||||
|
||||
#include "FileIconProviderTest.moc"
|
||||
Reference in new issue
Block a user