Commit graph

249 commits

Author SHA1 Message Date
Frank Reininghaus 8bf4aab73e Add some unit tests for grouping in KFileItemModel
Hopefully, this will prevent regressions in the future.

REVIEW: 111807
2013-08-04 21:08:57 +02:00
Frank Reininghaus 3f0ed8c44a Make KFileItemModelTest faster
The 500 ms timeout before items are resorted does not make much sense in
the unit test. Removing this delay makes the test run much faster.
2013-08-04 21:04:56 +02:00
Frank Reininghaus 7496f007cc Make it possible to select files like "a_b" using keyboard search
The problem was that pressing the Shift key would reset the keyboard
search.

BUG: 321286
FIXED-IN: 4.11.0
REVIEW: 111102
2013-06-20 19:32:25 +02:00
Dawit Alemayehu fda88516e9 Merge remote-tracking branch 'origin/KDE/4.10' 2013-06-20 08:41:12 -04:00
Frank Reininghaus 75ed1946f8 Ensure that the "Sort by Type" setting is respected
Before this commit, switching from, e.g., "Sort by Name" to "Sort by
Type" sometimes had no effect until the view was refreshed. The problem
was that the re-sorting was triggered before the type information was
actually added to the model.

BUG: 310705
BUG: 312014
FIXED-IN: 4.10.5
REVIEW: 111004
2013-06-18 17:39:56 +02:00
Frank Reininghaus bc9f7b8527 Remove trailing white space 2013-06-13 23:34:39 +02:00
Frank Reininghaus 04e825d022 Merge remote-tracking branch 'origin/KDE/4.10' 2013-05-22 18:34:25 +02:00
Frank Reininghaus 2f51debbea Do not reset the 'isExpanded' state when an expanded folder is refreshed
If an item is moved out of an expanded folder, the model receives the
dir lister's refreshItems signal for the folder. The method
retrieveData() then updates the folder's properties. This commit makes
sure that the 'isExpanded' state is not touched by retrieveData(). A
side-effect is that the 'isExpanded' role is not initialized to 'false',
but this does not matter because trying to read a non-existing role from
the QHash<QByteArray, QVariant> yields a default-constructed QVariant,
which evaluates to 'false'.

BUG: 299675
FIXED-IN: 4.10.4
REVIEW: 110401
2013-05-22 18:14:38 +02:00
Frank Reininghaus 600166152d Merge remote-tracking branch 'origin/KDE/4.10' 2013-05-12 10:04:01 +02:00
Frank Reininghaus 3924b10b62 Fix unit test failure
The recent commit 022b564831, which added
a few source files to kitemlistcontrollertest, caused a crash in that
test - an assert was hit because now a different virtual method was
called in one place (KStandardItemListView::initializeItemListWidget()),
and qobject_cast could not cast the 'item', which is of type
KFileItemListWidget, to its base class KStandardItemListWidget. Adding
the source file kfileitemlistwidget.cpp fixes this.

CCMAIL: ps_ml@gmx.de
2013-05-12 09:34:05 +02:00
Frank Reininghaus cad78cdfcf Merge remote-tracking branch 'origin/KDE/4.10'
Conflicts:
	CMakeLists.txt
2013-05-11 18:47:58 +02:00
Patrick Spendrin f6fcf4be85 fix building tests under windows 2013-05-10 23:03:23 +02:00
Frank Reininghaus 90dd897752 Improve handling of filtered items when folders are deleted/collapsed
If an expanded folder with filtered children is collapsed or removed,
and the parent-child relationship cannot be determined by parsing the
URLs, this patch makes sure that the filtered children do not reappear
when the filter bar is cleared.

REVIEW: 109455
2013-03-15 00:23:57 +01:00
Frank Reininghaus f71e0881d2 Merge remote-tracking branch 'origin/KDE/4.10'
Conflicts:
	dolphin/src/kitemviews/kfileitemmodel.cpp
2013-03-10 18:31:23 +01:00
Frank Reininghaus 9dd728cb98 Remove filtered children if the parent folder is collapsed
This is analogous to commit e053ecdcd5,
which fixes the same problem for the case that the parent folder is
deleted.

BUG: 316335
FIXED-IN: 4.10.2
REVIEW: 109343
2013-03-10 18:26:37 +01:00
Emmanuel Pescosta f2d70693db Big Thanks to Frank Reininghaus, who helped me a lot with these
changes! :)

* Fixed the "Network browser" and "timeline" issues, by using the
KDirLister's itemsAdded(KUrl,KFileItemList) signal -> Use the
given Url to define the parent-child relationship.

* Changed the name of the slot "slotNewItems" to "slotItemsAdded"
for consistency with the signal.

* Use a QHash<KFileItem, ItemData*> instead of a QSet<KFileItem> to
store the filtered data (needed to keep the O(1) lookup for filtered
KFileItems in slotItemsDeleted + needed to fix bug 311912 "After
erasing a filter, some thumbnails randomly disappear")

* Made the determination of the "expandedParentsCount" slightly
simpler - just adding 1 to the parent's level (Also needed to fix the
"Network browser" and "timeline" issues)

FIXED-IN: 4.11.0
REVIEW: 109180
BUG: 304565
BUG: 311912
BUG: 312890
BUG: 315593
2013-02-27 13:35:20 +01:00
Frank Reininghaus cc1455c0e6 Merge remote-tracking branch 'origin/KDE/4.10'
Conflicts:
	dolphin/src/tests/kfileitemmodeltest.cpp
	lib/konq/konq_operations.cpp
2013-02-19 15:45:44 +01:00
Frank Reininghaus 6938241ebc Remove items from m_filteredItems if their parent is deleted
Fixes the problem that filtered children of expanded deleted folders
reappear if the filter is cleared.

BUG: 315210
FIXED-IN: 4.10.1
REVIEW: 108976
2013-02-18 23:50:38 +01:00
Frank Reininghaus e6ef1eec3a Merge remote-tracking branch 'origin/KDE/4.10' 2013-02-17 12:17:01 +01:00
Frank Reininghaus ba31457911 Another fix for KItemListControllerTest::testMouseClickActivation()
One one machine, I see that changing the global "single click" setting
fails. I don't know why that is the case, but I think we should better
just skip the test in that case and not hang forever.
2013-02-17 12:12:52 +01:00
Frank Reininghaus d82d92d7dd Improve the recently added test testMouseClickActivation
The method to make sure that the first item is visible turned out to be
less reliable than I thought. This could make the test hang forever.
Moreover, this commit removes some trailing whitespace that had been
added accidentally.
2013-02-13 17:56:03 +01:00
Frank Reininghaus ced9de5b82 Merge remote-tracking branch 'origin/KDE/4.10' 2013-02-10 19:27:21 +01:00
Frank Reininghaus dc6322dc09 Re-organize the code that compares expanded items
The previous approach, which was based on comparing the URLs as
strings, was not only very complex, but also could lead to
inconsistencies in the model, namely, that not all children were
removed from the model when the dir lister reported the parent as
deleted. Later on, this could even lead to a crash.

BUG: 311947
FIXED-IN: 4.11
REVIEW: 108766
2013-02-10 18:09:07 +01:00
Frank Reininghaus 45450959ea Add benchmark for adding many child items in a tree structure 2013-02-10 18:07:55 +01:00
Frank Reininghaus 4f5a2eb943 Include parent-child relationships in KFileItemModel's consistency check 2013-02-10 18:06:07 +01:00
Frank Reininghaus ec628cfa09 Add unit test for bug 313342 2013-02-05 20:07:05 +01:00
Frank Reininghaus 5f6f77d481 Remove unneeded #include 2013-02-03 23:12:55 +01:00
Frank Reininghaus 5d4d73ff08 Merge remote-tracking branch 'origin/KDE/4.10'
Conflicts:
	dolphin/src/tests/kfileitemmodeltest.cpp
2013-01-30 21:06:34 +01:00
Frank Reininghaus 89134d62c7 Add unit test for bug 314046
The regression happened in the master branch only, but I think it
doesn't hurt to add the test to the stable branch.

CCBUG: 314046
2013-01-30 21:02:43 +01:00
Frank Reininghaus 1bd91417db Merge remote-tracking branch 'origin/KDE/4.10'
Conflicts:
	dolphin/src/tests/kfileitemmodeltest.cpp
2013-01-27 15:25:47 +01:00
Frank Reininghaus f76f3a1654 Move the consistency check for KFileItemModel from the test to the class
This makes it possible to check the model's consistency also in other
places, e.g., in KFileItemModel's benchmark.
2013-01-27 15:19:39 +01:00
Frank Reininghaus 891ee0c41a Add a unit test for a recently fixed crash
Before commit 90c7fd400c, adding a
KFileItem with an empty path caused a crash in
KFileItemModel::expandedParentsCountCompare().
2013-01-27 14:09:39 +01:00
Frank Reininghaus 71be8f2bee Add some benchmarks for KFileItemModel
The benchmark executable must be run manually. It is not run
automatically with the other unit tests to prevent waste of CPU cycles
in the not-so-uncommon situation that only test failures attract
attention.
2013-01-27 12:55:37 +01:00
Emmanuel Pescosta 256792355d Select right item as current item (first item after the deletion) after deleting files
BUG: 290736
REVIEW: 108356
FIXED-IN: 4.10
2013-01-14 20:01:03 +01:00
Frank Reininghaus 1353c92cce Fix some indentation issues 2012-10-30 08:25:21 +01:00
Emmanuel Pescosta a9b04801db Port Dolphin from Nepomuk to Nepomuk2 according to the Nepomuk2Port mini guide on techbase - http://techbase.kde.org/Projects/Nepomuk/Nepomuk2Port
REVIEW: 106825
2012-10-15 21:46:59 +02:00
Amandeep Singh cd1d45c831 Adding the Accessibility classes 2012-08-14 20:27:55 +05:30
Peter Penz b2f5de9744 Krazy fixes 2012-06-08 22:08:29 +02:00
Frank Reininghaus f061d2a6b3 Use an italic font for symbolic links
BUG: 298218
FIXED-IN: 4.9.0
2012-05-26 15:32:57 +02:00
Peter Penz d9eab08fcb Don't create a .directory-file for each directory
This regression has been introduced on master and has not been
released yet: Due to the changed properties-format an update has
been done which resulted in writing a .directory file into each
newly entered directory.

The patch updates the view-properties and version only in the
constructor so that it is assured that reading properties never
accidently will change the internal version.

A unit-test has been added to catch regressions like this in future.

BUG: 300240
FIXED-IN: 4.9.0
2012-05-18 19:43:17 +02:00
Peter Penz 727fd64e12 Create unit-test for KStandardItemModel 2012-05-17 22:00:39 +02:00
Peter Penz bca055a38e Add unit-test to test a possible crash when updating group-headers 2012-05-17 11:47:21 +02:00
Peter Penz 67f58d5082 Fix search-UI issues in combination with the new places entries
The places-entries for searching revealed some serious issues in
combination with the search-panel. Move the filtering away from
QDockWidget and bring it back below the search-bar.
2012-04-25 02:20:25 +02:00
Peter Penz ae4d11d918 Prepare view-engine for non-KFileItem usecase
Up to now the view-engine only provided a model-implementation that
supports file-items. The view-engine always had been designed to be able
to work with any kind of model, so now a KStandardItemModel is available.
The plan is to convert the places panel to the new view-engine. It should
be no problem to fix this until the feature freeze - in the worst case
the places-panel code could be reverted while still keeping the
KStandardItemModel changes.
2012-04-21 21:32:42 +02:00
Peter Penz 40c71d5ce0 KFileItemModel: interface cleanups
Fix some naming inconsistencies regarding the usage of 'dir' vs.
'directory' vs. 'folder'.
2012-04-11 21:53:45 +02:00
Peter Penz 6c3d9acbc2 KItemViews: Internal directory restructuration
- Move all private headers from the kitemviews-directory into
the 'private' subdirectory.

- Get rid of DolphinDirLister and just use a directory-lister
  internally in KFileItemModel.

- Minor interface-cleanups for signals
2012-04-11 16:08:32 +02:00
Frank Reininghaus aced85db1f KItemListKeyboardSearchManager: make it possible to choose the timeout
It's now possible to change the timeout, after which any call of
KItemListKeyboardSearchManager::addKeys(const QString&) starts a new
search, from the default value of 5000 milliseconds. This is not used
in Dolphin at the moment, but it permits to reduce the timeout to a
small value in the unit test. Before this change, the unit test took
more than 5 seconds to complete.
(cherry picked from commit 82fc1b54bd)
2012-03-29 20:05:49 +02:00
Frank Reininghaus bd26bf2a20 Increase the timeout in KItemListKeyboardSearchManager to 5 seconds
The previous timeout [QApplication::keyboardInputInterval()] was too
short to do a multi-letter search for users who do not type extremely
fast.
(cherry picked from commit 02eab49b2d)
2012-03-28 19:22:12 +02:00
Peter Penz d3a2f1ba82 Fix sorting-issue when "Sort folders first" is disabled
The comparison of expanded trees may not assume that directories
are always sorted first and must respect the "Sort folders first"
setting.

The sorting-unittest has been extended by a sub-tree and the usecase
of bug 296437. The already deactivated test for
KFileItemModel::expandedParentsCountCompare() has been completely removed
as it has been replaced by testSorting().

BUG: 296437
FIXED-IN: 4.8.2
2012-03-20 23:35:43 +01:00
Peter Penz 03a65da80a KFileItemModel: Remove minimum-update timer
The timer became unnecessary after introducing the behavior to
collect all new items until KDirLister emits a completed()-signal.
2012-03-20 17:23:28 +01:00
Peter Penz 21a5a890b3 Whitespace cleanups and documentation fixes 2012-02-23 17:28:03 +01:00
Peter Penz 0397658b81 Details view: Fix indicator-branches
Up to now no indicator-branches have been drawn when showing a tree. The patch
fixes this so that that the style-dependent branches are drawn.

The main part of the patch is the implementation of
KItemListView::updateSiblingsInformation(). Most of the other changes are
related due to an internal renaming of the expansionsLevel-role to
expandedParentsCount and some related cleanups.

BUG: 290276
FIXED-IN: 4.8.1
2012-02-14 18:05:29 +01:00
Frank Reininghaus 7f0aaff9b5 Test which items are activated when pressing Enter or Return
The ViewState struct gets a new bool member to indicate if the selected
items should have been activated after the last event or not. One could
argue that adding a bool parameter to the constructor is not optimal,
but I think adding an enum is not really worth the effort because the
struct is not used outside this unit test. Moreover, I could not think
of a good name for the enum type and its values.
(cherry picked from commit 307cca7b31)
2012-02-13 22:39:04 +01:00
Frank Reininghaus e1766d0e5f Fix regression in KItemListControllerTest
Since commit 66ce4db487, enabling or
disabling groupling may change the number of columns in the view.
Therefore, the test should first change the "grouping" setting and then
change the view geometry to make sure that the column count is correct.
(cherry picked from commit 61390b201a)
2012-02-13 20:21:57 +01:00
Frank Reininghaus d0933155e2 Replace setExpanded(const QSet<KUrl>&) by expandParentItems(const KUrl&)
The use case of this function (Folders Panel) requires the expansion of
the parent items of a single URL, so it's not needed to handle a full
set of URLs in this function. Moreover, the issue that not only the
parents, but also the URLs themselves were expanded is fixed by this
commit.
(cherry picked from commit 89082ca391)
2012-02-05 15:59:59 +01:00
Frank Reininghaus a2a78c98fc Simplify KItemListControllerTest::testKeyboardNavigation_data()
Function-static variables do not help much in a function which is
called exactly once.
(cherry picked from commit 847c8ebfd3)
2012-02-04 17:31:38 +01:00
Frank Reininghaus 6db0bec325 First version of a unit test for KItemListController
At the moment, only key press events are tested, and the current item
and selection after the event are verified.
Moreover, this commit makes sure that
KItemListController::keyPressEvent() really does not select anything
if the selection mode is NoSelection.
(cherry picked from commit 7457f4868c)
2012-02-01 22:08:16 +01:00
Patrick Spendrin 377ce832e1 fix build of tests on windows 2012-01-15 15:49:34 +01:00
Peter Penz 642f2804cd Temporary skip 2 unit-tests in KFileItemModel
KFileItemModel::resortAllItems() always emits a itemsMoved() signal since some
time. Before blindly adjusting the tests lets discuss first whether
resortAllItems() should be used in this context.
2012-01-05 21:41:04 +01:00
Peter Penz b2cb38214e Introduce "isExpandable" role
The role is used to determine whether a directory can be expanded at all. This
is e.g. not the case if a directory has 0 items or the target-URL is different
from the item-URL.

The expansion toggle will get hidden if a directory is not expandable.

CCBUG: 288521
2011-12-23 23:19:48 +01:00
Peter Penz 10659d97af Improve private method KFileItemModel::expansionLevelsCompare()
Get rid of the hack to access the m_itemData member for getting
the parent of an item during sorting. ItemData has been extended
by a parent-member which allows a fast and save way to do this.

Sadly this makes the unit-test for expansionLevelsCompare() more
complex and it has been temporary deactivated. I'll take care to
fix this during the next week.
2011-12-14 22:33:34 +01:00
Peter Penz 854b0acd1a Fix crash #1 when filtering items
When filtering items it was possible that the current index got
an invalid value which resulted in accessing the URL of a
null-KFileItem.

There is still one (general) open issue in KFileItemModelRolesUpdater
(crash #2) where a KFileItem that is already null gets read.
It is not really related to filtering but can be triggered
quite easy when filtering huge directories with enabled previews.

CCBUG: 287642
2011-12-04 18:21:46 +01:00
Peter Penz 7b8fbf7374 Reimplement name-filtering
The filtering of items has not been implemented yet in
the KFileItemModel of the new view-engine. The patch brings back
this functionality again, but some minor issues are open:
- When filtering trees expanded directories should only get
  hidden if no child is visible
- Regular expressions are not supported yet (they have not been
  supported in Dolphin 1.x but it is now quite simple to implement).
- When filtering previews and removing the filter it might be
  possible that the preview is not shown (is most probably an
  an already existing bug in KFileItemModelRolesUpdater).

BUG: 287642
FIXED-IN: 4.8.0
2011-11-30 00:24:33 +01:00
Frank Reininghaus 3950eccaf0 Fix restoring expanded URLs
When navigating back or forward in history, DolphinView tells the
KFileItemModel about the expanded URLs which should be restored before
the folder is entered. In this case, the algorithm in the new function
KFileItemModel::setExpanded(const QSet<KUrl>&) does not work. To fix
this, the old function
KFileItemModel::restoreExpandedUrls(const QSet<KUrl>&) is restored.

Unit test included.
2011-11-24 23:38:36 +01:00
Peter Penz b27e599429 Initial draft for bringing back the "Folders" panel
The folders panel has been adjusted to use the new view-engine.
A lot of things don't work yet, but are mostly minor issues that
should be fixable during the next 10 days.
2011-11-20 19:35:01 +01:00
Peter Penz d27f776cd2 Internal KFileItemModel optimizations and cleanups
- Use merge-sort instead of quick-sort. This assures a sane
  worst-case scenario where quick-sort has a runtime complexity of
  O(n*n) (e.g. when changing the sort-order from ascending to
  descending).

- lessThan()-improvements: Change internal data-structures to
  allow a comparison of any role, not only roles available
  in KFileItem

- Don't synchronously move an item if the value has been changed
  of a role defined as sort-role: This is too expensive in case if
  e.g. the sorting is done by "type" and the type is determined
  step by step.
2011-10-31 19:38:02 +01:00
Peter Penz c872dcbda9 Fix sorting-issues when value of a sort-role has been changed
If the value of a sort-role has been changed, emitting the signal
itemsChanged() is not sufficient as from the KItemModelBase point
of view an item has been moved or deleted/reinserted.

Corresponding to the unit-test KFileItemModel::setData() respects
this case correctly now, however there are some minor visual
animation issues left that (hopefully) should not be tricky to
solve.
2011-10-30 21:01:43 +01:00
Peter Penz 283f97ac27 Interface cleanups to prepare the return of "grouped sorting"
- Rename setCategorizedSorting() to setGroupedSorting()
- Change the model interface to allow enabling/disabling grouping
  without the need to declare a role (the sort role will be taken).
- Add dummy group role implementation in KFileItemModel

The grouping code itself requires some cleanups and might crash
at the moment or lead to weird layouts.
2011-10-15 22:55:01 +02:00
Frank Reininghaus aeb16937ce Add function KItemListSelectionManager::isSelected(int index)
This function is used in KItemListView::updateWidgetProperties()
to find out if an item is selected in a more efficient way.
The new function is tested in KItemListSelectionManagerTest.
I've factored out some code from
KItemListSelectionManagerTest::testChangeSelection() to a new
member to simplify the test.
2011-10-03 16:42:02 +02:00
Frank Reininghaus 7424fcc331 Keep current item and selection when resorting, part 1
KFileItemModel now emits the itemsMoved signal when the model
is resorted, and KItemListSelectionManager has a new function
itemsMoved() which will be called indirectly when this signal
is emitted. Unit tests for the new functionality are included.
The following things are still needed to make the feature
work:
1. KFileItemMdel::resortAllItems() should not emit
   itemsAdded/itemsRemoved any more.
2. KItemListView::itemsMoved() must update the view according
   to the changes in the model, and it must call
   KItemListSelectionManager::itemsMoved().
2011-09-29 20:50:00 +02:00
Frank Reininghaus 8879f5e752 Implement 'Sort By Size'
It only works for files so far. The sorting of folders
by the number of items is more tricky to get right because
this number is retrieved asynchronously by
KFileItemModelRolesUpdater.
2011-09-18 16:50:44 +02:00
Frank Reininghaus 31d3b91813 Implement some missing sorting options
Changing the sort order and enabling/disabling the
"Sort Folders First" option works now.
2011-09-18 15:03:45 +02:00
Frank Reininghaus 9424f5a789 Implement restoring expanded folders in Details View 2011-09-17 14:35:25 +02:00
Frank Reininghaus 9dc7cd79e7 KItemListKeyboardSearchManager improvements and unit tests
This commit implements a 'repeated key search' feature, similar
to QAbstractItemView, and adds unit tests for keyboard searching.
2011-08-30 18:22:56 +02:00
Frank Reininghaus 78a38f2000 Remove unneded function KItemListSelectionManager::anchorItem() 2011-08-27 10:23:40 +02:00
Frank Reininghaus ea765ba573 Simplify KItemListSelectionManager
1. The anchorChanged() signal is not needed.
2. The only place where setAnchorItem() is called is in
   beginAnchoredSelection() -> merge both functions.
2011-08-26 18:39:32 +02:00
Peter Penz 26648a0264 Fix issue that removing an item is not recognized
Thanks to Tirtha Chatterjee for the patch!

REVIEW: 102435
2011-08-26 08:09:50 +02:00
Peter Penz cae90c168e Fix issues with the anchor selection
Don't change the selection if the anchor is invalid. This fixes
the issue that items might get selected during changing a directory.
2011-08-24 22:37:16 +02:00
Frank Reininghaus 63e82a2b3b Add unit test for expanding folders in KFileItemModel 2011-08-15 21:06:06 +02:00
Frank Reininghaus dd71994b6c Fix for KFileItemModel::expansionLevelsCompare
Before this commit, expanding and collapsing folders in the details
view would lead to strange results in a folder with the items "a",
"a/a/", "a/a/1", "a/a-1/", and "a/a-1/1".  The problem was that the
comparison between "a/a/1" and "a/a-1/1" went wrong: the first
character in which the paths differ is a "/" in one of the items, such
that the code that reduces this 'index' in
KFileItemModel::expansionLevelsCompare in order to find the 'common
path' did nothing because it checked that only *one* of the two items
does not have an "/" at the position 'index'.
2011-08-15 13:05:53 +02:00
Frank Reininghaus 7b911df33e Two small selection improvements in DolphinView
1. Implement DolphinView::clearSelection().
2. Simplify DolphinView::invertSelection().
   I found, fixed, and unit-tested a bug in the selection
   manager which was uncovered by this change.
2011-08-14 11:05:19 +02:00
Frank Reininghaus 58ab93541c Implement selection of items using mouse clicks. 2011-08-13 11:51:38 +02:00
Frank Reininghaus 9b83d15be4 Test signal emission on selection changes
This commit adds a unit test that changes the selection in various
ways, verifies the result and checks that the selection manager's
selectionChanged signal has been emitted correctly. The test is
data-driven, so I hope that most further testing needs can be
fulfilled by adding new test data.

Moreover, I changed selectedItems() such that the anchored
selection is only taken into account if anchor and current item
are different. The reason is that in some situation the anchor
should not be selected initially (i.e., if an already selected
item is Control-clicked). If the anchor should be selected from
the beginning, it must be selected manually.
2011-08-11 14:23:53 +02:00
Frank Reininghaus 01ff60edee Emit KitemListSelectionManager's selectionChanged signal correctly
This commit makes sure that the signal is emitted with the correct
current and previous selection after a selection change, and
that the signal is emitted exactly once in
KItemListSelectionManager::itemsInserted and
KItemListSelectionManager::itemsRemoved.
2011-08-11 12:23:21 +02:00
Frank Reininghaus a03f7dcd22 Implement beginAnchoredSelection() and endAnchoredSelection().
Unit test included.
2011-08-10 15:21:26 +02:00
Frank Reininghaus 2e3b7e6dd3 Always use the 'Select' mode for anchored selections
In Dolphin, we don't actually use the 'Deselect' and 'Toggle'
modes for anchored selections, so we can just remove these
modes and always use 'Select' to reduce code complexity.
2011-08-10 13:53:41 +02:00
Frank Reininghaus 258a29f61f Initial support for anchored selections in the selection manager 2011-08-10 11:43:05 +02:00
Frank Reininghaus bb80d1877a Update the anchor item when items are added or removed
If items are added or removed in the model, not only the
current item, but also the anchor item, which is the
starting point for any selections via Shift+Click or
Shift+Key, needs to be updated.
BUG: 262638
FIXED-IN: 4.8.0
2011-08-10 10:38:24 +02:00
Frank Reininghaus 84aa4e75b4 Test setting the current item and anchor item 2011-08-09 19:44:49 +02:00
Peter Penz 3957884bf2 Improvements for selections, smooth scrolling, tooltips and info-panel 2011-08-09 16:22:36 +02:00
Peter Penz f23e9496f3 Merged very early alpha-version of Dolphin 2.0
Dolphin 2.0 will get a new view-engine with the
following improvements:
- Better performance
- Animated transitions
- No clipped filenames due to dynamic item-sizes
- Grouping support for all view-modes
- Non-rectangular selection areas
- Simplified code for better maintenance

More details will be provided in a blog-entry during
the next days.

Please note that the code is in a very
early alpha-stage and although the most tricky parts
have been implemented already very basic things like
drag and drop or selections have not been pushed yet.
Those things are rather trivial to implement but this
still will take some time.
2011-07-30 20:13:41 +02:00
Frank Reininghaus 6d4cfc25d4 Wait longer for the selectionChanged signal
The timeout for the selectionChanged signal is increased in
DolphinViewTest_AllViewModes::verifySelectedItemsCount().
I hope that this will fix a part of the failures seen in
http://my.cdash.org/testDetails.php?test=6350150&build=196639
2011-06-09 14:50:33 +02:00
Frank Reininghaus 91e210ad6d Improve stability of DolphinView tests
1. Fix possible test failure if hidden files are shown initially.
2. Fix possible test failure if a .directory file is created in
the test directory. I think that this fixes the test failure from
http://my.cdash.org/testDetails.php?test=6350151&build=196639
2011-06-09 14:41:53 +02:00
Frank Reininghaus 34fec35b56 Don't try to build dolphinsearchboxtest if Nepomuk isn't found. 2011-05-26 09:03:50 +02:00
Alex Merry f192c0d663 Compile with QT_USE_FAST_OPERATOR_PLUS 2011-05-23 19:57:44 +01:00
Frank Reininghaus c7ef72de55 SVN_SILENT Remove trailing white space. 2011-04-14 13:27:33 +02:00
Frank Reininghaus 6d7e993c26 Improve stability of unit tests when running them with Valgrind
I noticed unexpected unit test failures when running the tests with
Valgrind. The reason was that test execution was slowed down a lot,
such that that TestBase::waitForFinishedPathLoading() did not receive
the view's signal within the default timeout of 2 seconds, and that
this failure was not detected in every test -> the tests failed later
on because not all expected items had been loaded yet.

To fix this, I changed two things:
1. Added an assert in TestBase::waitForFinishedPathLoading() that checks
if the signal has been received. Continuing does not make much sense if
that is not the case.
2. Increased the default timeout to 20 seconds. The reason why there is
a finite timeout at all is that I didn't want to waste too much time on
machines where the file kioslave seems to have problems loading a
directory (I've seen corresponding test logs at cdash.org). However, with
the first change I mentioned above, the waiting time is lost only once
(due to the assert) rather than every time a directory is loaded
-> I think that the timeout increase does not lead to an increased waste
of time on such machines.
2011-04-14 13:10:33 +02:00
Frank Reininghaus e152885d94 Implement a cut/copy/paste unit test for DolphinView. 2011-04-12 21:44:31 +02:00
Frank Reininghaus 2784a14b76 Add unit test for bug 270437
Verify that the current item and the scroll position of the view do not
change if previews are turned off. Actually, the bug was in
KFilePreviewGenerator, but it's easier to test this here.
2011-04-10 21:27:15 +02:00
Frank Reininghaus a9ecea7cd1 Do not reload the DolphinView in the tests' initView() members
Rather than reloading the view after it is initilised, we just wait
until the view emits its finishedPathLoading() signal. This saves some
time when running the tests (at least on my system).
2011-04-06 11:44:01 +02:00
Frank Reininghaus f1e69dce8a Remove a qWait(2000) which has been committed accidentally.
This has been committed by accident in 06dd174f.
2011-04-05 23:02:32 +02:00
Frank Reininghaus c58d84c261 Add function TestBase::waitForFinishedPathLoading()
Many tests have to wait until this signal is received from the
DolphinView, so it is convenient to have a function that wraps
the QTest::kWaitForSignal() call.
2011-04-05 22:12:51 +02:00
Frank Reininghaus 7148704d72 Remove comment which is obsolete after the recent refactoring. 2011-04-05 21:34:07 +02:00
Frank Reininghaus 95cb8ffe01 Dolphin unit test refactoring
This commit changes mainly two things:
1. The functionality related to the handling of temporary files and
folders is moved to a new class TestDir.
2. The setup of a temporary folder and of DolphinView instances is
now done in each unit test function. A benefit of this change is that
there are no unwanted interactions between different unit test functions
any more. Moreover, different test functions could now share a test
folder more easily.

Additionally, the reference arguments of all functions are changed to
pointers for consistency.
2011-04-03 15:32:12 +02:00
Kevin Ottens dfe02a06b5 Make it link 2011-03-21 18:11:51 +01:00
Peter Penz d3496b1231 Coding style update for pointer comparison
Most developers seem to prefer
  if (ptr) ...
  if (!ptr) ...
in comparison to
  if (ptr != 0) ...
  if (ptr == 0) ...

Adjusted the Dolphin-code to use the "most-prefered style" to make contributors happy.
2011-02-09 19:24:27 +01:00
Aaron Reichman 6af0a792a2 Fixing krazy spelling errors 2011-02-07 12:58:14 -08:00
Andreas Hartmetz c1e805adf6 dolphinsearchboxtest: link with gold 2011-02-05 06:19:02 +01:00
Peter Penz 17d217b862 Add unittest for DolphinSearchBox
A minor API cleanup in DolphinSearchBox has been done related to the test.
2011-02-04 22:13:50 +01:00
Peter Penz 8eb9b508ca Use capitalized KDE includes 2011-02-04 15:43:21 +01:00
Frank Reininghaus a2ac570198 Some additions to DolphinDetailsViewTest_AllViewModes.
In particular, tests for changing the zoom level and for saving and
restoring the view state.

svn path=/trunk/KDE/kdebase/apps/; revision=1217270
2011-01-26 13:38:19 +00:00
Frank Reininghaus 72fb2ca0a8 Make dolphinviewtest_columns more stable.
Up to now, some Columns View tests that need a folder to be displayed
in the view only passed if they were run first: The first test always
passed, and if a test name was passed on the command line, such that
only this test would be run, this test would work as well. In other
cases, the view was empty, not showing the items in the folder.

The problem is worked around by creating a new DolphinView before each
test in the case of the Columns View. Added a TODO comment to make me
remember to look into this again at some point.

svn path=/trunk/KDE/kdebase/apps/; revision=1217260
2011-01-26 13:20:36 +00:00
Frank Reininghaus e85b2ef0ad Improve DolphinViewTest_AllViewModes::testKeyboardFocus().
The test assumes that the view does not have the keyboard focus
initially. However, this may not be the case if this is the only test
to be executed (i.e., if testKeyboardFocus is passed to the test
executable on the command line). This commit transfers the keyboard
focus explicitly to another widget.

svn path=/trunk/KDE/kdebase/apps/; revision=1217251
2011-01-26 13:12:49 +00:00
Frank Reininghaus 8653fc7f87 Add a unit test that checks the DolphinView functionality that is
related to the folder view properties.

svn path=/trunk/KDE/kdebase/apps/; revision=1216359
2011-01-22 20:39:20 +00:00
Frank Reininghaus 519c2d435f Improve DolphinTreeViewTest's stability.
When running the test in the background while using the computer for
other things, it may happen that the test's widgets are not focused,
which led to an infinite loop before this commit. I've removed the
checks that caused this loop because the only thing that is important
for the test is that the view loses the keyboard focus at some point
(see bug 220898).

svn path=/trunk/KDE/kdebase/apps/; revision=1215139
2011-01-17 19:36:00 +00:00
Frank Reininghaus ae59d894c2 DolphinTreeViewTest: Add unit test for bug 220898 (rubberband
selection failure after a keyboard focus change in between key press
and key release events)

svn path=/trunk/KDE/kdebase/apps/; revision=1214822
2011-01-16 14:13:30 +00:00
Frank Reininghaus aefa8ce888 DolphinTreeViewTest: Add unit test for bug 259656 (multiple file
deletion if Shift+Delete is pressed for some time and the confirmation
dialog is disabled).

svn path=/trunk/KDE/kdebase/apps/; revision=1214651
2011-01-15 19:12:37 +00:00
Frank Reininghaus 8ac62cc953 Improve tests for DolphinTreeView's code that updates the selection
when a key is pressed.

svn path=/trunk/KDE/kdebase/apps/; revision=1214565
2011-01-15 11:43:59 +00:00
Peter Penz a48679b36b Fix implementation of DolphinView::invertSelection() which assures that DolphinView::hasSelection() provides a valid return-value. This looks like an issue in Qt, but I did not have the time yet to provide a Qt-only example for a bug-report :-(
svn path=/trunk/KDE/kdebase/apps/; revision=1213199
2011-01-09 15:03:30 +00:00
Peter Penz fae8ba471b Encapsulate the creation and handling of the directory lister, the model and proxy model to DolphinView. By this it will be easier later to replace the traditional QAbstractItemViews by any kind of other implementation (e.g. based on QGraphicsView/QML).
svn path=/trunk/KDE/kdebase/apps/; revision=1213189
2011-01-09 13:58:35 +00:00
Peter Penz 420b696c7c SVN_SILENT: Use same comment-style as the other unit-tests
svn path=/trunk/KDE/kdebase/apps/; revision=1210710
2011-01-01 20:59:54 +00:00
Peter Penz f8a60e4d85 Add test for the keyboard-focus
svn path=/trunk/KDE/kdebase/apps/; revision=1210707
2011-01-01 20:46:51 +00:00
Peter Penz 0da54e5c1b Show an undetermined progress indication within one second after changing an URL.
svn path=/trunk/KDE/kdebase/apps/; revision=1205329
2010-12-10 21:54:53 +00:00
Frank Reininghaus 28c5cd8336 1. Also use a time out when waiting for the view's selectionChanged signal.
2. Reduce the time out for the finishedPathLoading signal.

svn path=/trunk/KDE/kdebase/apps/; revision=1202815
2010-12-02 11:56:47 +00:00
Frank Reininghaus 05b6549e25 Use the correct libraries for the test in the CMake file.
svn path=/trunk/KDE/kdebase/apps/; revision=1202160
2010-11-29 21:27:18 +00:00
Frank Reininghaus f45966d9c3 Use kWaitForSignal to wait until the view has finished reloading. I've
also added a timeout such that the tests fail rather than hang if the
file kioslave dies (which happens sometimes according to some test
logs on cdash.org).

svn path=/trunk/KDE/kdebase/apps/; revision=1202159
2010-11-29 21:24:53 +00:00
Frank Reininghaus bdcca2b903 Add a unit test for the basic selection-related functionality of
DolphinView. The main testing code is inside an abstract base
class. Three classes inherit this base class and do the actual testing
in one view mode each.

svn path=/trunk/KDE/kdebase/apps/; revision=1202157
2010-11-29 21:15:35 +00:00
Frank Reininghaus cd1ced9158 Some minor changes in DolphinDetailsViewTest:
1. Remove unneeded includes
2. Fix typo
3. Add newline at end of file.

svn path=/trunk/KDE/kdebase/apps/; revision=1200027
2010-11-23 17:14:04 +00:00
Frank Reininghaus 0fa3148780 Simplify dolphindetailsviewtest by moving code that is shared by all
test to init() and cleanup().

svn path=/trunk/KDE/kdebase/apps/; revision=1199721
2010-11-22 14:10:26 +00:00
Frank Reininghaus 730ac2c597 Backup and restore the zoom level in
bug234600_overlappingIconsWhenZooming() such that it's the standard
value again in the following test. Also verify that the zoom level is
as expected after each call to DolphinView::setZoomLevel(int).

svn path=/trunk/KDE/kdebase/apps/; revision=1199137
2010-11-20 19:13:57 +00:00
Frank Reininghaus 5e7da43c2d Make sure that an item's visualRect in the Details View is not wider
than the "Name" column. Fixes keyboard navigation problems if files
with very wide names are present in the current folder.

Unit test included.

CCBUG: 257401


svn path=/trunk/KDE/kdebase/apps/; revision=1199123
2010-11-20 17:53:38 +00:00
Frank Reininghaus 10cd05f1a4 Add unit test which checks that DolphinDetailsView::expandedUrls()
works as expected.

svn path=/trunk/KDE/kdebase/apps/; revision=1198202
2010-11-17 20:59:05 +00:00
Frank Reininghaus 9504508da2 Add unit test for bug 201459.
svn path=/trunk/KDE/kdebase/apps/; revision=1194790
2010-11-09 22:04:51 +00:00
Frank Reininghaus 1a03245395 1. Add method TestBase::reloadViewAndWait().
2. Remove some debug output from DolphinDetailsViewTest - it seems
that the test failure I saw on cdash.org is due to a failing kioslave,
which is probably not Dolphin's fault.

svn path=/trunk/KDE/kdebase/apps/; revision=1194514
2010-11-09 08:33:45 +00:00
Frank Reininghaus da44e5e0b2 Add unit test for bug 217447.
To make it work, I had to make DolphinTreeView::indexAt public, but
this method is public in the base class anyway.

svn path=/trunk/KDE/kdebase/apps/; revision=1194511
2010-11-09 08:23:33 +00:00
Frank Reininghaus b1e69cae00 It's easier to put functionality that is used by many unit tests into
a common base class. I took that idea from Nepomuk's unit tests in
kdelibs.

svn path=/trunk/KDE/kdebase/apps/; revision=1191051
2010-10-29 14:13:11 +00:00
Frank Reininghaus d81d56a640 Add some debug output to DolphinDetailsViewTest
I've seen the test fail due to timeout at
http://my.cdash.org/index.php?project=kdebase&date=
Maybe some debug output helps to find the cause for this.

svn path=/trunk/KDE/kdebase/apps/; revision=1189677
2010-10-25 14:51:10 +00:00
Andreas Hartmetz 4ca9aeaad2 Link with gold, KDirModel is in KIO. Also remove redundant
QT_QTCORE_LIBRARY - KDE4_*_LIBS includes dependencies.

svn path=/trunk/KDE/kdebase/apps/; revision=1188673
2010-10-22 22:29:56 +00:00
Frank Reininghaus 28bc452f0d Add a second Dolphin unit test (for a regression in DolphinDetailsView
which has been fixed recently). This commit also adds a new class
TestHelper which provides some funtionality that most Dolphin unit
tests will need. I hope that this makes implementing additional tests
as easy as possible :-)

svn path=/trunk/KDE/kdebase/apps/; revision=1188536
2010-10-22 15:41:47 +00:00
Andreas Hartmetz ef87498e52 Link with gold
svn path=/trunk/KDE/kdebase/apps/; revision=1188148
2010-10-21 14:11:09 +00:00
Frank Reininghaus 1c27b1d154 Add a first unit test for Dolphin, which verifies that the fix for one
of the problems related to Dolphin's modifications to QTreeView works
as it should.

This is only a small start, but I hope that we can cover at least the
basic functionality of DolphinView, the three item views and possibly
a couple of other classes with a rather stable API soon.

svn path=/trunk/KDE/kdebase/apps/; revision=1188049
2010-10-21 07:58:56 +00:00
Peter Penz 8fd40e72aa Just use KMimeType::extractKnownExtension() instead of the custom implementation. Thanks to David Faure for the hint!
svn path=/trunk/KDE/kdebase/apps/; revision=819137
2008-06-10 17:22:24 +00:00
Peter Penz 3db4843c35 fixed issue that when renaming "Open office.org writer documentation.pdf" that only "Open office" is selected and ".org writer documentation" is handled as extension
BUG: 158228

svn path=/trunk/KDE/kdebase/apps/; revision=778329
2008-02-23 11:59:57 +00:00
David Faure 609ce09292 Moving code around in dolphin fixes DnD support in konqueror :)
svn path=/trunk/KDE/kdebase/apps/; revision=748476
2007-12-14 15:53:40 +00:00
Laurent Montel 3b73c9c865 Adapt CMakeLists.txt as discussed with Alex.
KDE4_ADD_TEST_EXECUTABLE is deprecated now use KDE4_ADD_EXECUTABLE(<target> TEST <files>) instead
QT4_ADD_DBUS_INTERFACE_NO_NAMESPACE and QT4_ADD_DBUS_INTERFACES_NO_NAMESPACE are deprecated too
used SET_SOURCE_FILES_PROPERTIES(<files> PROPERTIES NO_NAMESPACE TRUE) QT4_ADD_DBUS_INTERFACES(<srcList> <files>)
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) is put in each CMakeLists.txt where
KDE4_ADD_EXECUTABLE(<target> TEST <files>) and KDE4_ADD_UNIT_TEST were used.

svn path=/trunk/KDE/kdebase/apps/; revision=716149
2007-09-24 06:25:59 +00:00
Allen Winter 62d81f9a9b remove kde4_automoc()
svn path=/trunk/KDE/kdebase/apps/; revision=685984
2007-07-10 09:14:12 +00:00
Andreas Pakulat d098f9641a Port to new kde4_add_*test* macros
svn path=/trunk/KDE/kdebase/apps/; revision=676863
2007-06-17 21:14:54 +00:00
David Faure 3aa47b789b Make the test link (moving renamedialog to libdolphinprivate since we'll need that feature in the part anyway)
svn path=/trunk/KDE/kdebase/apps/; revision=666229
2007-05-19 08:03:39 +00:00
Peter Penz 15b965af3a David Faure wrote:
> Sounds like the kind of method that would benefit greatly from a unit test :)

OK, committing my first unit test for KDE. Although very minimal it's at least a start ;-) (currently deactivated as I've some problem in CMakeList.txt)

svn path=/trunk/KDE/kdebase/apps/; revision=666162
2007-05-18 23:36:58 +00:00