┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests
AgeCommit message (Collapse)Author
8 daysdolphinmainwindowtest: ensure consistent starting state for places panel testsSebastian Englbrecht
In a fresh test environment there is no saved session, so the places panel may not be visible. Explicitly show it before testing. Additionally, focus-related assertions require the window to be the active window — setFocus() on dock widget contents has no effect on an inactive window. Replace the weak QTRY_VERIFY_WITH_TIMEOUT(activeWindow() != nullptr, 100) with requestActivate() + qWaitForWindowActive() to enforce this precondition.
8 daysAdd REUSE/SPDX compliance headers to all filesSebastian Englbrecht
Dolphin was missing copyright and license information on ~750 files, which would cause the KDE CI job `gitlab-templates/reuse-lint.yml` to fail. This commit makes the project fully compliant with REUSE Specification 3.3. REUSE.toml is used for file categories that cannot carry inline comments or are managed externally: - po/**: covered with precedence=aggregate so the bulk declaration combines with individual translators' existing inline headers - **/*.kcfg, **/*.kcfgc: KConfigXT schema files, no comment syntax - doc/*.png: documentation screenshots - src/icons/*.png: application icons (LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL) - src/**/*.{qrc,rc,desktop,xml,json,knsrc,upd,in}: resource and metadata files without usable comment syntax - .gitignore, .git-blame-ignore-revs: infrastructure, CC0-1.0 - logo.png: application artwork (LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL) Inline SPDX headers are added to all source files that support comments (C++, QML, CMake, shell scripts, Python). A small number of remaining binary or single-purpose files retain individual .license sidecars. License inference heuristic (applied per file, in order): 1. Existing inline SPDX-License-Identifier — reused as-is 2. Most common license among sibling files in the same directory that already carry SPDX info, excluding infrastructure filenames (.gitignore etc.) and requiring at least two qualifying neighbors to prevent a single CC0 CI config from pulling source files along 3. Default: GPL-2.0-or-later Copyright years and authors are sourced from `git log --follow` per file. Automation accounts (l10n daemon [email protected], Weblate) are excluded from author lists. If more than 5 authors are found only a generic KDE Contributors was used.
8 dayskitemlistcontrollertest: fix memory leaksSebastian Englbrecht
8 dayskitemlistcontrollertest: add drag-move hover signal testsSebastian Englbrecht
Two tests via new simulateDragMove/simulateDragLeave helpers: - testDragMoveHoverIdempotency: repeated drag-move over the same item must not emit itemHovered more than once; moving to a different item must emit itemUnhovered/itemHovered exactly once each. - testDragLeaveHoverCleanup: dragLeaveEvent must emit itemUnhovered for the currently hovered item and nothing when no item is hovered.
8 daystests: create smoke test for dolphinSebastian Englbrecht
11 daystests: add ctest lint rule forbidding bare QTest::qWait()Sebastian Englbrecht
Bare qWait(N) calls in tests are easy to reintroduce inadvertently. Add a ctest check that greps test sources for qWait() and fails if any call is found without an // UNAVOIDABLE: comment on the same line. The error message explains why the pattern is forbidden, lists the signal-based alternatives, and shows how to suppress the check for the rare cases where no signal or pollable condition exists.
11 daystests: replace QTest::qWait(N) with signal-based waitsSebastian Englbrecht
Fixed-time sleeps are a source of intermittent failures on slow CI machines — if the delay is too short, the test races ahead of the code under test. Replacements made: - dolphinmainwindowtest: qWait() calls replaced with QTRY_COMPARE, QTRY_VERIFY, qWaitFor lambdas and processEvents() where animations are disabled; one genuinely unavoidable timer wait marked // UNAVOIDABLE: - kitemlistcontrollerexpandtest: qWaitFor(..., 100ms) / qWaitFor(..., 300ms) replaced with spy->wait() loops that block until all expected directoryLoadingCompleted signals have arrived - kitemlistkeyboardsearchmanagertest: timer-driven wait marked // UNAVOIDABLE: (must wait for keyboard search timeout to expire) Add testhelpers.h providing TestHelpers::disableAnimations(), which eliminates the need for delays that previously waited for Qt UI animations to settle.
12 daysviewproperties: fall back to .directory when xattr space is exhaustedSebastian Englbrecht
When saving view properties to extended attributes failed with NoSpace, the code cleared the xattr entry and returned without writing anything to disk. The .directory fallback file was never created, silently losing the user's view settings. Fix by copying the current settings into a file-backed KConfig pointing to .directory whenever the xattr write returns NoSpace. The copy uses KConfigGroup::copyTo per group (not KConfig::copyFrom, which replaces the entire entry map) so that unrelated groups already present in .directory — such as a [Desktop Entry] group carrying a custom folder icon — are left untouched by sync().
13 daysviewproperties: respect saved properties for special folders with global ↵Pan Zhang
view props enabled When "Use common display style for all folders" is enabled, the useDefaultSettings condition was always true because useGlobalViewProps was the first term in the OR chain. This caused special folders controlled by useSearchView, useTrashView, and useRecentDocumentsView to reset to their default view on every load, overriding any user customization. Restrict the unconditional default-apply to non-special folders only. For special folders, the existing timestamp-based check handles the logic correctly, and the fallback in the else branch still applies defaults when no saved properties exist (first visit). BUG: 520089
13 daystests: kfileitemmodeltest avoid scheme-less urlMéven Car
2026-04-03dolphinmainwindow: use directly ShowMenubar actionOleksandr Bondar
to change menuBar visibility The menubar check was defined by menubar isHidden var. The logic has been reverted. The toggleShowMenuBar func was simply inverting the isVisible var. Now it's being set the menubar isChecked value. This led to testedObjectsSizeAfterTraversingForwards=10 instead of 11 (apparently there was a phantom object), so adjust the comparation in dolphinmainwindowtest. BUG: 492298
2026-04-02kfileitemmodel: sort dotted numeric names naturallyPan Zhang
Natural sorting already handled plain numeric chunks, but names containing dots between numeric segments were still ordered lexically in important cases. This broke expected ordering for decimal-style names like 0.09 and 0.1, and for version-like names such as v1.2.3 and v1.2.10. Teach KFileItemModel's natural string comparison to recognize dotted numeric chains instead of relying solely on QCollator's numeric mode. Compare two-part numeric chains (e.g. 0.09 vs 0.1) as decimal values, and compare longer chains segment by segment like version numbers, while still treating real file extensions separately so names like 1.09.txt keep working correctly. Add a direct unit test for KFileItemModel::stringCompare covering decimal-style names, version-like dotted numeric names, numeric basenames with extensions, leading-dot names, and the non-natural sorting fallback. BUG: 411707
2026-03-18DolphinTabPage: Prevent re-entrant signal activation for slotViewActivatedMāris Nartišs
When switching tabs with split view enabled and the filter bar visible, a storm of activation calls is triggered and at the end signal/slot connections for both views is a mess (no listeners, navigation buttons linked to unfocused view etc.). Disconnect DolphinTabPage slot when it changes its own state. BUG: 508554, 512011, 508405, 511076, 503576
2026-03-14dolphinmainwindowtest: correct assertions in testViewModeAfterDynamicViewMéven Car
2026-03-12kfileitemmodeltest: Add a test for the new KFileItemModel's filter modesAlessio Bonfiglio
2026-03-11viewproperties: Add per-folder zoomWagner Soares
Adds ZoomLevel flag to the directory and uses it instead of global settings when globalViewProps is set to false. CCBUG: 169405
2026-03-11tests: prevent warnings open not checked in createFileMéven Car
2026-02-21viewproperties: don't use intermediate tmp file to save viewpropsMéven Car
2026-01-21Add keyboard anchor assignments to mouse eventsTomasz Kot
The mouse events need to modify the keyboard anchor assignments as well, because selecting an item with a mouse and then navigating with keyboard wouldn't follow the same selection. BUG: 508609
2026-01-20dolphinview: when creating a subfolder expand to it if in details modeMéven Car
So the new folder is in view.
2026-01-12viewproperties: remove temp file after loading defaultConfigSergey Katunin
It turns out that since f6c97d52220be9bd996b71309051e56ff7aa1834 a temp file is created here with each `save()` call for this default config, which is not deleted later. In another place where `defaultProperties()` is called for `m_node`, the file is deleted in the destructor of this class. But it is not deleted here. So, remove temp file after loading defaultConfig or it will create temp file on each save() operation in /tmp folder. Also keep the global/.directory file when xattr isn't supported. BUG: 510500
2026-01-10Use Q_ASSERT instead of Q_CHECK_PTR for plain checks of pointer valueFriedrich W. H. Kossebau
Q_CHECK_PTR (other than the name suggests) is intended only to check the success of memory allocations. Using it for any pointers instead can be misleading due to the "Out of memory" log printed in case of hits.
2025-11-12Revert "Avoid implicitly selecting items"Nate Graham
This reverts commit 122fee5625f0285ec4ebda79162c72390989eb2a. This behavior change was well-intentioned, but has significant usability and speed drawbacks that have not been addressed: - Keyboard-driven folder manipulation became slower - Unexpected behavioral differences when opening files with the pointer compared to when opening them with the keyboard introduced inconsistency and cognitive load - Unexpected opening of selection mode during fast operation introduced the potential for confusion and additional errors - Dolphin's behavior became inconsistent with that of other file managers users may be accustomed to The bug tracker, discuss.kde.org, and Reddit are full of complaints about this change. It's been a year now; I think it's clear that many Dolphin users have not gotten used to and accepted it. I have to count myself as one of them, I'm afraid. I've tried to get used to it for a year, but I just have not been able to. I don't believe the benefits of this change outweigh the drawbacks, so let's revert it. 24d859cf19e90fa22ed687b36a68231625c1bd80 was explicitly mentioned as a thing that should also be reverted in this case, but it's already been done. BUG: 494125 BUG: 511966 CCBUG: 424723 CCBUG: 492404 FIXED-IN: 25.12.0
2025-11-10dolphin: improve keyboard search behavior for repeated charactersweinan li
The original keyboard search implementation had a limitation when dealing with files containing repeated characters like 44.txt. When typing 44, it would trigger rapid navigation to the next item starting with 4 instead of matching the full string 44. This patch introduces a smarter search strategy: 1. First attempt full string matching for exact file names 2. If full match fails and user is typing repeating characters, fall back to rapid navigation using either: - Last successful search string (for extended searches like 444 -> 4444) - First character only (original rapid navigation behavior) The changes include: - Modified changeCurrentItem signal to include a found parameter for search result feedback - Added m_lastSuccessfulSearch to track successful searches for better fallback behavior - Used Qt::DirectConnection to ensure synchronous execution for immediate result feedback This provides better user experience when searching for files with repeated characters while maintaining the rapid navigation feature for quick browsing. BUG: 501851
2025-10-23dolphinmainwindotest: harden some testsMéven Car
2025-10-23dolphinmainwindowtest: prevent kaboutdata warningsMéven Car
2025-10-21Fix a couple compiler warningsMéven Car
2025-10-03Add integration test for split view activation and tab title update after ↵Wendi Gan
renaming a folder In a split-view tab, the child folder is opened in the left view and other tabs, while the parent folder is opened in the right view. After renaming the child folder from the right view: - The activated view should not switch to the left view. - All tab titles should be updated. CCBUG: 496414
2025-09-03Fix several user-facing and non-user-facing typosKunda Ki
Found via `codespell -S "*.desktop,*.po,*.svg,*.xml,./po" -L aparent,childs,goup,lokal`
2025-06-28clean includeMéven Car
2025-05-28dolphinview: Add a dynamic view optionVictor Blanchard
Added a 'dynamic view' option, which allows to switch from a 'compact' or 'details' view to an 'icons' view if most of the files in the directory are images or videos. It reverts to the previous view mode when we switch to a directory which doesn't meet that criteria. The view mode is only changed once so users don't have to undo that for specific folders when they don't want icon view. A setting is added in the "Display style" section of the general view setting page. BUG: 491139
2025-04-29Clazy fixMéven Car
2025-04-07Rewrite search integrationFelix Ernst
This huge commit is a nearly complete rewrite of the Dolphin search code. It implements most of the improved Dolphin search UI/UX as designed and discussed in a collaborative effort by Kristen McWilliam, Jin Liu, Andy Betts, Tagwerk, a few others and me. See https://invent.kde.org/system/dolphin/-/issues/46. # Notable changes - A toggle to change the search tool is provided as most contributors deemed that useful in https://invent.kde.org/system/dolphin/-/merge_requests/642#note_985112. - The default search is changed to filenamesearch for maximum reliability. - Removing all search parameters will take users back to the view state prior to starting a search instead of keeping the search results open. - The UI for choosing file types or modification dates has been made more powerful with more granularity and more options. - Most search parameters can be configured from a popup menu which gives us extra space for extra clarity. - Labels and help buttons as well as hyperlinks to settings makes sure the user always knows why some search parameters are unavailable in some contexts. - Chips show important search parameters while the popup is closed. They allow quickly removing filters. - The titles of the search and the input field placeholder message change to make clear whether file names or file contents are searched. - When the user actively switches the search tool, whether content should be searched, or whether to search everywhere, this is preserved for the initial state of the search bar when the user opens it the next time after restarting Dolphin. # Architecture - The new DolphinQuery class is independent of the UI and contains all search parameters modifiable in Dolphin as easy setters and getters. - DolphinQuery objects are also used to update the states of every component in the search UI. There is now a clear separation of UI and search configuration/DolphinQuery. - DolphinQuery is responsible for exporting to and importing from search URLs. - The search UI always reflects the currently configured DolphinQuery no matter if the user changed the UI to change the DolphinQuery or loaded a DolphinQuery/older search URL which then is reflected in the UI. - I tried to simplify all classes and their interaction between each other as much as possible. - I added some tests BUG: 386754 CCBUG: 435119 CCBUG: 458761 BUG: 446387 BUG: 470136 CCBUG: 471556 CCBUG: 475439 CCBUG: 477969 BUG: 480001 BUG: 483578 BUG: 488047 BUG: 488845 BUG: 500103 FIXED-IN: 25.08
2025-02-24Add smaller statusbar and set it as defaultAkseli Lahtinen
- Statusbar has three modes: Small, FullWidth and Disabled - FullWidth is the original statusbar - Small is the new default statusbar - This statusbar overlays on top of the items instead of taking space - It changes size according to content - Disabled turns statusbar completely off - Zoom slider and space information is only shown in full-width statusbar - Space information is now always on - If user navigates with keyboard, or scrolls to selection, the scrolling will take the statusbar into account - This makes sure the statusbar does not cover any items Related discussion: https://invent.kde.org/system/dolphin/-/issues/50
2025-02-22kitemlistkeyboardsearchmanager: smarter search start positionYifan Zhu
Search from the next position for new search and special repeated key search. Otherwise search from the current position, which is current selected item if something is selected or in selection mode, and 0 (the beginning) otherwise. Test plan: - create directory with files ab1, ab2, and ab3 - click ab2, and press escape to deselect - type ab; verify that ab1 is selected - wait a while, type ab again, verify that ab2 is selected - wait a while, type ab again, verify that ab3 is selected - click ab1, type ab, verify that ab2 is selected BUG: 422951
2025-02-20kitemlistcontrollertest: fix warningsMéven Car
NO_CHANGELOG
2025-02-08viewpropertiestest: simplify two testsMéven Car
2025-02-08Viewproperties: prevent loosing view settingsMéven Car
When they match the hardcoded internal settings, when they should be kept as long as they don't match the currently set default viewproperties. Is saved in metadata the diff with the hardcoded internal defaults still. A stable default reference allows to change defaults without changing existing saved viewproperties. CCBUG: 495878
2025-02-03implement shortcut action for file creationChristian Schwarz
BUG: 462899
2025-02-01Ignore diacritical marks for keyboard searchThomas Moerschell
When using keyboard search, normalize the item names and remove marks first. Now, items containing characters with marks can be found using keyboard search. BUG: 482394
2025-01-30Change three view buttons into one with menu arrowAkseli Lahtinen
Instead of showing three buttons, which is quite visually noisy, show only one button that is split: First button, when clicked, loops through the view modes. Second smaller button with the down arrow shows menu of the available view modes. See also https://invent.kde.org/system/dolphin/-/issues/68#toolbar-button-changes Alternative for https://invent.kde.org/system/dolphin/-/merge_requests/893 ![Screencast_20250121_123718](/uploads/e8625c485c58a9c47e8168106b3e7419/Screencast_20250121_123718.mp4)
2024-12-29Have special keyboard controls in selection modeFelix Ernst
Prior to this commit keyboard controls and behaviour of Dolphin's main view were identical no matter if selection mode was enabled or not. While selection mode makes it impossible to accidentally clear the selection by singular mouse clicks, any press of an arrow key on the keyboard would still clear the full selection which goes against selection mode's objective. Furthermore, keyboard-only users had no reason to ever enable selection mode because it made no difference to them. This commit changes this by offering a changed control scheme for key presses while in selection mode. Arrow key presses without modifier now only move focus between items but do no longer clear or change the selection. Similarly, Page Up/Down, Home, and End key presses only move keyboard focus. Enter, Return, and Space key presses now only toggle the selection for the current item. The above controls are however mostly unchanged when combining them with Modifier keys like Shift or Control. The type-ahead feature is also changed in selection mode to only move keyboard focus without changing the selection. This way keyboard users are less likely to clear their selection by mistake. Regression tests are added for these selection mode controls. The code changes to change this keyboard behaviour are quite minimal. Most of the added code is for making selection mode accessible. That's because we need to make sure the changed control scheme is properly announced and communicated or a blind user will be left utterly confused why the normal keyboard controls "stopped working". Enabling or disabling selection mode is announced to accessibility software. Furthermore whenever focus goes to the main view, the selection mode state is also mentioned when active. BUG: 458091
2024-12-19dolphinview: Update thumbnail on filename changeAkseli Lahtinen
If filename of an item was updated previously, it would modify the model before the file was actually changed. This led to the model calling a signal that would try to run a previewjob, but since the filename is not actually changed yet on disk, it would fail. This patch moves the model updating after copyjob. Copyjob will take care of the file renaming if there is already existing file. We just need to update the model correctly after the job has succeeded. BUG:497555
2024-12-16ViewProperties: Return nullptr if viewPropertiesString is emptyAkseli Lahtinen
If viewPropertiesString is empty, return a nullptr. This will later used in the stack by the defaultProperties call. In defaultProperties, if we can't find the global directory, create new one with a tempfile. If tempfiles can't be created, use default instead. This will ensure that view settings are saved and loaded correctly if user has separate view properties per folder. This will also add an unit test, where we create a global directory, modify it and make sure the changes are reflected in the unmodified folder. BUG:495878
2024-12-09Fix inline renaming multiple files when renaming changes sorting orderIlia Kats
Suppose we are renaming file i and the new name will be sorted after file i+1. We are now pressing ArrowDown to immediately start renaming file i+1. However, because of the sorting we would not actually end up renaming what used to be file i+1. What would happen is that editing would be started in dolphinview.cpp:2065. However, after 100 ms the timer in KFileItemModel would fire, resulting in the model emitting itemsMoved(). This would trigger doLayout() in KItemListView::slotItemsMoved(). doLayout() resizes the KItemListWidgets, wich causes the renaming to be canceled in KStandardItemListWidget::resizeEvent(). Now, we start a new renaming operation for the correct widget after the relayouting is complete.
2024-12-04Always focus the view after place activationFelix Ernst
This one-liner makes sure keyboard focus always moves to the active view when a place in the places panel is activated. Previously focus would remain on the places panel if the activated location was identical to the already displayed location. This added consistency is helpful because keyboard-only users will get used to be able to move from the places panel to the view by pressing the Enter key, even though this does not always work prior to this commit. This issue was identified in an accessibility scan done by HAN University of Applied Science.
2024-11-19natural sort: exclude extension when comparing filenamesEren Karakas
Currently natural sort compares the entire filenames (basename.extension) when sorting. This causes eg. "a 2.txt" to appear before "a.txt" when sorted by ascending. This is unintuitive since people prioritize basenames more than file extensions. Instead, change natural sort to compare by basename only and fallback to comparing extensions if basenames were equal. This change causes "a.txt" to appear before "a 2.txt" and matches how other platforms such as GNOME and Windows behave. BUG: 416025 BUG: 470538 BUG: 421869 BUG: 312027
2024-11-12Test that each object has distinguishable accessible infoFelix Ernst
This commit extends the dolphinmainwindowtest for the accessible tree to test that each object a user can reach through the Tab key or the Shift+Tab key combination is distinguishable by its accessible info from the previous object. Objects are considered distinguishable if they have different accessible names or their first ancestor with an accessible name is different.
2024-10-31Make Escape move focus from location bar to viewFelix Ernst
Pressing Escape on the location bar while in breadcrumb mode has no effect at all. This commit changes this to instead move the focus to the active view. This is more logical because a user pressing escape while having focus on the location bar is no longer interested in interacting and changing the location in the location bar. They most likely want to act on the current location instead.
2024-10-31refactor: replace QString() with QStringLiteral() for better performanceZhangzhi Hu