void ViewPropertiesTest::testUseAsDefaultViewSettings()
{
- // Create new test directory for this test to make sure the settings are defaults
- auto testDir = new TestDir(QDir::homePath() + "/.viewPropertiesTest-");
- auto cleanupTestDir = qScopeGuard([testDir] {
- delete testDir;
- });
-
// Create a global viewproperties folder
QUrl globalPropertiesPath =
QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).append("/view_properties/").append(QStringLiteral("global")));
ViewProperties globalProps(globalPropertiesPath);
// Check that theres no .directory file and metadata is supported
- QString dotDirectoryFile = testDir->url().toLocalFile() + "/.directory";
+ QString dotDirectoryFile = m_testDir->url().toLocalFile() + "/.directory";
QVERIFY(!QFile::exists(dotDirectoryFile));
- KFileMetaData::UserMetaData testDirMetadata(testDir->url().toLocalFile());
+ KFileMetaData::UserMetaData testDirMetadata(m_testDir->url().toLocalFile());
KFileMetaData::UserMetaData globalDirMetadata(globalPropertiesPath.toLocalFile());
if (!testDirMetadata.isSupported()) {
QSKIP("need extended attribute/filesystem metadata to be usefull");
auto defaultData = globalDirProperties.data();
// Load testdir data
- QScopedPointer<ViewProperties> testDirProperties(new ViewProperties(testDir->url()));
+ QScopedPointer<ViewProperties> testDirProperties(new ViewProperties(m_testDir->url()));
auto testData = testDirProperties.data();
// Make sure globalDirProperties are not empty, so they will be used
void ViewPropertiesTest::testUseAsCustomDefaultViewSettings()
{
- // Create new test directory for this test to make sure the settings are defaults
- auto testDir = new TestDir(QDir::homePath() + "/.viewPropertiesTest-");
- auto cleanupTestDir = qScopeGuard([testDir] {
- delete testDir;
- });
-
// Create a global viewproperties folder
QUrl globalPropertiesPath =
QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation).append("/view_properties/").append(QStringLiteral("global")));
ViewProperties globalProps(globalPropertiesPath);
// Check that theres no .directory file and metadata is supported
- QString dotDirectoryFile = testDir->url().toLocalFile() + "/.directory";
+ QString dotDirectoryFile = m_testDir->url().toLocalFile() + "/.directory";
QVERIFY(!QFile::exists(dotDirectoryFile));
- KFileMetaData::UserMetaData testDirMetadata(testDir->url().toLocalFile());
+ KFileMetaData::UserMetaData testDirMetadata(m_testDir->url().toLocalFile());
KFileMetaData::UserMetaData globalDirMetadata(globalPropertiesPath.toLocalFile());
if (!testDirMetadata.isSupported()) {
QSKIP("need extended attribute/filesystem metadata to be usefull");
QCOMPARE(defaultData->viewMode(), DolphinView::Mode::DetailsView);
// Load testdir data, set to icon, i.e default hardcoded, not current user default
- QScopedPointer<ViewProperties> testDirProperties(new ViewProperties(testDir->url()));
+ QScopedPointer<ViewProperties> testDirProperties(new ViewProperties(m_testDir->url()));
testDirProperties->setViewMode(DolphinView::Mode::IconsView);
testDirProperties->save();