┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorWagner Soares <[email protected]>2026-02-19 17:57:02 -0300
committerMéven Car <[email protected]>2026-03-11 16:33:57 +0000
commit0f7a9c681c4f7336362bf8a5d1c41f2bc8ed9215 (patch)
tree247b5517d24f773a7d6d964474b8b1d92b257b38 /src/tests
parent69dd9b4ef427a697dc04a329917cdfba62c5b145 (diff)
viewproperties: Add per-folder zoom
Adds ZoomLevel flag to the directory and uses it instead of global settings when globalViewProps is set to false. CCBUG: 169405
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/dolphinmainwindowtest.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/tests/dolphinmainwindowtest.cpp b/src/tests/dolphinmainwindowtest.cpp
index f68f07cbc..fd207c09a 100644
--- a/src/tests/dolphinmainwindowtest.cpp
+++ b/src/tests/dolphinmainwindowtest.cpp
@@ -1144,6 +1144,9 @@ void DolphinMainWindowTest::testViewModeAfterDynamicView()
QCOMPARE(view->m_mode, DolphinView::DetailsView);
QVERIFY(!ViewProperties(view->viewPropertiesUrl()).dynamicViewPassed());
+ // store parent current zoom level
+ const int parentZoomLevel = view->zoomLevel();
+
// go to child folder and make sure view mode change to "Details" is permanent
m_mainWindow->openFiles({testDirUrl + "/a"}, false);
view->m_model->loadDirectory(QUrl(testDirUrl + "/a"));
@@ -1151,6 +1154,47 @@ void DolphinMainWindowTest::testViewModeAfterDynamicView()
QVERIFY(modelDirectoryLoadingCompletedSpy.wait());
QCOMPARE(view->m_mode, DolphinView::DetailsView);
QVERIFY(ViewProperties(view->viewPropertiesUrl()).dynamicViewPassed());
+
+ // still on child, change view zoom level
+ const int childZoomLevel = view->zoomLevel();
+ view->setZoomLevel(childZoomLevel + 2);
+
+ // go back to parent folder and check for zoom level
+ m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Back))->trigger();
+ view->m_model->loadDirectory(testDir->url());
+ view->setUrl(testDir->url());
+ QVERIFY(modelDirectoryLoadingCompletedSpy.wait());
+ QCOMPARE(view->zoomLevel(), parentZoomLevel);
+ QVERIFY(!ViewProperties(view->viewPropertiesUrl()).dynamicViewPassed());
+
+ // go to child and check if zoom level is permanent
+ m_mainWindow->openFiles({testDirUrl + "/a"}, false);
+ view->m_model->loadDirectory(QUrl(testDirUrl + "/a"));
+ view->setUrl(QUrl(testDirUrl + "/a"));
+ QVERIFY(modelDirectoryLoadingCompletedSpy.wait());
+ QCOMPARE(view->zoomLevel(), childZoomLevel + 2);
+ QVERIFY(ViewProperties(view->viewPropertiesUrl()).dynamicViewPassed());
+
+ // test for global views
+ settings->setGlobalViewProps(true);
+ settings->save();
+
+ // go back to parent folder and set zoom level
+ m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Back))->trigger();
+ view->m_model->loadDirectory(testDir->url());
+ view->setUrl(testDir->url());
+ view->setZoomLevel(parentZoomLevel + 1);
+ QVERIFY(modelDirectoryLoadingCompletedSpy.wait());
+ QTRY_COMPARE_WITH_TIMEOUT(view->zoomLevel(), parentZoomLevel + 1, 400);
+ QTRY_VERIFY_WITH_TIMEOUT(ViewProperties(view->viewPropertiesUrl()).dynamicViewPassed(), 400);
+
+ // go to child and check if zoom level remains the same
+ m_mainWindow->openFiles({testDirUrl + "/a"}, false);
+ view->m_model->loadDirectory(QUrl(testDirUrl + "/a"));
+ view->setUrl(QUrl(testDirUrl + "/a"));
+ QVERIFY(modelDirectoryLoadingCompletedSpy.wait());
+ QTRY_COMPARE_WITH_TIMEOUT(view->zoomLevel(), parentZoomLevel + 1, 400);
+ QTRY_VERIFY_WITH_TIMEOUT(ViewProperties(view->viewPropertiesUrl()).dynamicViewPassed(), 400);
}
void DolphinMainWindowTest::testActivationAndTabTitleAfterRenameOpeningFolder()