2019-07-31 07:05:39 +02:00
|
|
|
#include <QString>
|
|
|
|
#include <QtTest>
|
|
|
|
|
|
|
|
#include <dgiofile.h>
|
|
|
|
#include <dgiofileinfo.h>
|
|
|
|
|
|
|
|
class DGioSimpleFileInfoTest : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
DGioSimpleFileInfoTest();
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void testCase_RegularFile();
|
|
|
|
};
|
|
|
|
|
|
|
|
DGioSimpleFileInfoTest::DGioSimpleFileInfoTest()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
void DGioSimpleFileInfoTest::testCase_RegularFile()
|
|
|
|
{
|
|
|
|
QTemporaryFile tmpFile("test_RegularFile.txt");
|
|
|
|
QVERIFY(tmpFile.open());
|
|
|
|
QFileInfo tmpFileInfo(tmpFile);
|
|
|
|
|
|
|
|
QScopedPointer<DGioFile> file(DGioFile::createFromPath(tmpFileInfo.absoluteFilePath()));
|
2019-08-02 05:30:32 +02:00
|
|
|
QExplicitlySharedDataPointer<DGioFileInfo> fi = file->createFileInfo();
|
2019-07-31 07:05:39 +02:00
|
|
|
QCOMPARE(file->basename(), tmpFileInfo.fileName());
|
|
|
|
QCOMPARE(file->path(), tmpFileInfo.absoluteFilePath());
|
2019-08-02 05:30:32 +02:00
|
|
|
QCOMPARE(fi->fileSize(), tmpFileInfo.size());
|
2019-08-06 09:33:34 +02:00
|
|
|
qDebug() << fi->iconString() << fi->contentType();
|
2019-08-06 07:08:43 +02:00
|
|
|
QVERIFY(fi->themedIconNames().contains("text-plain")); // is this check okay? better approach?
|
2019-07-31 07:05:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
QTEST_APPLESS_MAIN(DGioSimpleFileInfoTest)
|
|
|
|
|
|
|
|
#include "tst_simplefileinfo.moc"
|