Commit graph

276 commits

Author SHA1 Message Date
Alexander Potashev 1aaafe178c Rewrite servicemenu helper utility in C++
Summary:
     - Also support MIME type "application/x-compressed-tar".
     - Update tests in Ruby, remove SimpleCov.

BUG: 399229

Test Plan: Ruby tests passed

Reviewers: sitter, elvisangelaccio, ngraham

Reviewed By: elvisangelaccio

Subscribers: cfeck, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D21878
2019-07-15 01:39:15 +03:00
Méven Car cdad6a513e Fix tests relating to the removal of the Root Place in D15739
Summary: See D15739

Test Plan: ctest

Reviewers: elvisangelaccio, ngraham

Reviewed By: elvisangelaccio, ngraham

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D21789
2019-06-23 16:09:53 +02:00
Andrew Crouthamel 1b985d1ef4 Add Documents shortcut detection
Summary:
This adds support for Documents detection when included as a default
as implemented in D16852. This is a work-in-progress and currently
does not succeed.

Assistance is welcome.

Test Plan: Run ctest within the dolphin build directory.

Reviewers: #dolphin

Subscribers: elvisangelaccio, kfm-devel, ngraham

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D16967
2019-05-20 16:59:35 -06:00
Elvis Angelaccio 957a6f4f31 [PlacesItemModelTest] Rename variable
This variable is not the expected size of the groups list, but it's the
expected index of the 'Remote' group in the model.
2019-05-05 17:53:29 +02:00
Elvis Angelaccio 8989e52088 Merge branch 'Applications/19.04' 2019-05-05 17:02:59 +02:00
Elvis Angelaccio d41d3be348 [PlacesItemModelTest] Ignore user tag places
Instead of listing the user tags (as tried in D21017), the test should not have
access to the user's baloo DB in the first place.

To do so, we use a QTemporaryDir as $HOME for the test process and for
its ioslave children (by setting KDE_FORK_SLAVES=yes).

While at it, drop the no-op removeTestUserData() function.
2019-05-05 16:52:16 +02:00
Elvis Angelaccio f3a86bf29e Merge branch 'Applications/19.04' 2019-05-05 16:02:46 +02:00
Elvis Angelaccio 33a0d17ea8 Try again to fix PlacesItemModelTest::testDefaultViewProperties()
Commit bff373d598 was not enough because the model takes into
account the global view properties setting (in PlacesItemModel::initializeDefaultViewProperties()).

This means we need to disable the setting before init() runs.
2019-05-05 15:54:12 +02:00
Nate Graham 546ff9a19e Merge branch 'Applications/19.04' 2019-04-18 13:17:13 -06:00
Nate Graham 48c082767e Fix adding "Create New..." menu to toolbar
Summary:
Access the object by its existing name rather than renaming it.

BUG: 405780
FIXED-IN: 19.04.1

Test Plan:
- Add {nav Create New} item to toolbar; it now works
- Verify that {nav Create New} menu and toolbar items are disabled when in the trash
- All tests still pass

Reviewers: elvisangelaccio, broulik, #dolphin, cfeck

Reviewed By: cfeck

Subscribers: cfeck, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D20664
2019-04-18 13:17:00 -06:00
Elvis Angelaccio 93f26f799f Merge branch 'Applications/19.04' 2019-04-07 22:51:05 +02:00
Elvis Angelaccio 30a335cbcf [DolphinMainWindowTest] Fix testNewFileMenuEnabled
The newFileMenu enabled status is updated whenever the KDirLister emits
the `completed` signal: use QTRY_COMPARE so that we can wait for it.
2019-04-07 22:42:50 +02:00
Elvis Angelaccio d47090eb13 [KFileItemModelTest] Port to fastInsert()
We already depend on KF5 > 5.47, so we are ready to switch to the
non-deprecated fastInsert() method.
2019-04-07 17:16:01 +02:00
Elvis Angelaccio aee1b07e26 Merge branch 'Applications/19.04' 2019-03-23 10:51:17 +01:00
Harald Sitter af8c491904 find ruby gems & make coverage conditional on BUILD_COVERAGE
Summary:
new finding tech:
- find_gem function configures gem-specific FindFoo files and wraps around
  find_package
- FindFoo files look for ruby and then attempt to require the gem name
  i.e. it checks if the gem can be successfully loaded by the interpreter
- since this is based on find_package it may be influenced in all the
  regular ways (e.g. forced found or disabled from finding altogether
  via CMAKE_DISABLE_FIND_PACKAGE_$PKGNAME)

various notes for the future:
- technically this isn't 100% correct because the require name of a gem and
  the gem name may not be the same. e.g. the gem `docker-api` has the
  require name `docker`. for all currently used gems the names are however
  the same and so simply requiring the gem name is expected to work
- the implementation doesn't care about versions, again because we don't
  need it to
- test-unit is a bundled gem, some distributions (e.g. Arch) do split it
  out without making suitable dependency arrangements on a package level
  though

the tech is heavily inspired by Aleix Pol's tech for finding QML modules
as seen in extra-cmake-modules

Test Plan:
- ruby not found: none of the modules found
- test-unit not present: error
- simplecov not prseent: never errors
- having a module installed or not is reported in the cmake output

Reviewers: #dolphin, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D19856
2019-03-21 10:56:11 +01:00
Elvis Angelaccio bff373d598 Fix PlacesItemModelTest::testDefaultViewProperties()
The test was assuming that global view properties are off by default,
which is no longer true after d6c086ad04.
2019-03-20 21:36:31 +01:00
Harald Sitter 644d6f8522 redo service menu ruby helpers from ground up more or less
Summary:
- apply ruby community style guidelines
- full rewrite fixing, among other things:
  - inefficient/unreadable String#end_with reimplementation
  - inefficient use of Kernel.system (forked shell to fork a shell)
  - inefficient/unreadable Dir.glob reimplementation
  - inefficient File initialization for single chmod
  - invocation conditions are now actually readable
  - invocation conditions now also force +x on argless scripts, not just
    scripts that need arguments
  - repetitive conditions are now expressed as loops on argument arrays
  - mime detection now uses xdg-mime instead of file (xdg-mime internally
    may fall back to mime but will prefer higher level tools such as
    kmimetypefinder5; giving better results overall)
  - return values of "backtick forks" are now checked and will produce
    suitable errors on stderr
  - fail now takes a log_msg argument which is printed to stderr. this
    is in addition to the error raised as notification for the user, as
    that is unfortunately not so useful for diagnostics
  - overall error handling and logging of problem causes is much improved
- add license headers. the original code was actually fairly exhaustive, so
  this really should have had a header to begin with. the code was
  originally introduced in svn r1045663 on Nov 6 14:56:35 2009 UTC
- add blackbox tests. in the interest of keeping the scripts actually
  simple scripts (as opposed to a bunch of classes used by even simpler
  scirpts) they are now also covered by test rigging which runs them as
  scripts (again, as opposed to individual unit testing of distinct units)
  - the tests optionally can use simplecov to gather coverage metrics
  - also wired up to ctest so it actually gets run

structurally there is actually a fair amount of overlap between the two
scripts, but again, in the interest of keeping things simple I think it's
better to live with that instead of refactoring a shared library out of
it and then use heavy-duty meta-programming

Reviewers: #dolphin, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D19334
2019-03-18 14:02:16 +01:00
Laurent Montel e5ebb31e54 Consti'fy 2019-01-11 07:03:26 +01:00
Elvis Angelaccio 504db3f702 Fix title update when changing active split view
Summary:
The DolphinTabPage::activeViewUrlChanged signal triggers the title
update in DolphinMainWindow, which sets the new title from the
`m_activeViewContainer` instance.

This means we need to notify the main window that the active view
changed before telling it that the current url changed.

BUG: 402641
FIXED-IN: 18.12.1

Reviewers: #dolphin, rizzitello, ngraham

Reviewed By: #dolphin, rizzitello, ngraham

Subscribers: rizzitello, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D17881
2019-01-05 17:29:34 +01:00
Elvis Angelaccio f0e66d3465 Add failing test case for bug #402641
CCBUG: 402641
2018-12-31 00:21:25 +01:00
Yuri Chornoivan fd1a078cc4 Fix minor typos 2018-10-25 21:23:44 +03:00
Elvis Angelaccio ec3cf251b1 Revert "[PlacesItemModelTest] Make test fail on purpose"
This reverts commit dd8fce5594.

Got what I was looking for, from the CI logs.
2018-10-13 23:24:32 +02:00
Elvis Angelaccio dd8fce5594 [PlacesItemModelTest] Make test fail on purpose
Needed to check whether on the CI KDirWatch emits the `created` signal when we
refresh the places model.

Will be reverted soon.

GIT_SILENT
2018-10-13 22:26:36 +02:00
Elvis Angelaccio 277700425e [PlacesItemModelTest] Revert last two commits
Commit c527dc2172 proves that on the CI sometimes the `QAbstractItemModel::dataChanged`
signal is not being emitted at all (build #208 failed because the test timed out).

KFilePlacesModel emits `dataChanged()` in the `_k_reloadBookmarks()`
slot only when it's called after the KBookmarkManager emits the `changed()` signal.

And the `changed()` signal is emitted after KDirWatch emits the
`created` signal.

On the CI server kdirwatch is probably not reliable, which would explain
why the test randomly fails.
2018-10-13 22:06:32 +02:00
Elvis Angelaccio c527dc2172 [PlacesItemModelTest] Try to use an event loop instead of an hardcoded timeout
Increasing the timeout from 5 to 10 seconds didn't work.
Let's see if an eventloop does the job.
2018-10-13 12:09:32 +02:00
Elvis Angelaccio c9dd3478be [PlacesItemModelTest] Try to double test timeout
The randomly failing `testRefresh()` on the CI can be reproduced by
replacing the QTRY_COMPARE with a simple QCOMPARE.

So it seems the CI can be slow such that the default QTR_COMPARE
timeout of 5 seconds is not enough.

If a timeout of 10 seconds fixes this particular test case, we can use
this bigger timeout also in the other failing tests.
2018-10-13 11:18:46 +02:00
Elvis Angelaccio 96f7a25b3d [PlacesItemModelTest] Improve name of helper method
removePlaceAfter(index) is a bit misleading, because it seems we are
going to remove the place after index `index`.

This method is just scheduling the removal of the place instead.
The method name should be consistent with what it actually does.
2018-10-10 23:03:03 +02:00
Elvis Angelaccio 8a932cb837 [PlacesItemModelTest] Try harder to not hardcode indexes
This test is still randomly failing on the CI (only on master though).
Let's see if this fixes it for good.
2018-10-09 22:58:38 +02:00
Elvis Angelaccio 092d08f5e8 Fix implicit-fallthrough gcc warning
GIT_SILENT
2018-10-07 23:07:32 +02:00
Elvis Angelaccio 949da1fb31 [DolphinMainWindowTest] Attempt to fix testOpenInNewTabTile() on the CI
Both icon `name()`s are empty on the CI, which probably doesn't have
icons or something. This should hopefully fix it.
2018-10-07 21:37:35 +02:00
Elvis Angelaccio 54ae7f2488 [DolphinMainWindowTest] Add some debug output
testOpenInNewTabTitle() is currently failing on the CI, this should help
investigate why.
2018-10-07 21:19:12 +02:00
Elvis Angelaccio 4c40ad45ef Fix another stale comment
PlacesItemModel::updateBookmarks() is gone since commit da6f8fe086.
2018-10-07 20:03:41 +02:00
Elvis Angelaccio 7904ae417a Merge branch 'Applications/18.08' 2018-10-07 19:53:08 +02:00
Elvis Angelaccio e2f93a2829 [PlacesItemModelTest] More index-related fixes
Again, we cannot assume the Desktop and Downloads places are always
around.
2018-10-07 19:41:54 +02:00
Elvis Angelaccio 4a56d21fb1 [PlacesItemModel] Fix testSystemItems() 2018-10-07 19:28:56 +02:00
Elvis Angelaccio e99827293b [PlacesItemModelTest] Fix testHideItem() 2018-10-07 18:01:00 +02:00
Elvis Angelaccio 26d02ecbdb [PlacesItemModelTest] Fix testTearDownDevice() 2018-10-07 17:49:36 +02:00
Elvis Angelaccio 0abba76eea [PlacesItemModelTest] Fix testDeletePlace()
If the Desktop or Downloads folder is missing, using 5 as index would be
wrong.
2018-10-07 17:41:54 +02:00
Elvis Angelaccio 9204f3272b [PlacesItemModelTest] Fix testGroups() test case
The test was also assuming that the Desktop and Downloads folders are
always available, which isn't the case.
2018-10-07 17:26:28 +02:00
Elvis Angelaccio 92157f6d7d Follow-up of commit 9760f9607d
Also drop the hardcoded model count all over the place.
2018-10-07 17:07:56 +02:00
Elvis Angelaccio 9760f9607d [PlacesItemModelTest] Check whether Desktop and Download folders exist
KFilePlacesModel creates the Desktop and Downloads bookmarks only if
their folder exists.

This should hopefully fix the failing test on the CI (actual count = 15,
expected count = 17), since the CI runs in docker and probably doesn't
have those two folders by default.
2018-10-07 16:50:27 +02:00
Elvis Angelaccio dec7016c0d Add test cases for enabled status of DolphinNewFileMenu
Summary:
Root and Trash test cases are currently failing because of
commit e133c4557e.

Reviewers: #dolphin

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D16005
2018-10-07 15:43:34 +02:00
Elvis Angelaccio a23acffd5e Add test case for open-in-new-tab title regression
Fix will be in D15112.

CCBUG: 397910
2018-09-02 10:55:51 +02:00
Jaime Torres Amate e03cbe2584 Make this test work again with new uds implementation
Summary:
With the new uds implementation, when some data is meant to replace an old one, it has to use replace() instead of insert() to avoid an assert of data already exists.
Use 3 different entries and only insert().

Test Plan:
before: crash in the uds assert
after: passes the test

Reviewers: #dolphin, #frameworks, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: bcooksley, bshah, nalvarez, cfeck, dfaure, aacid, ngraham, bruns, elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D13813
2018-08-16 13:50:52 +02:00
Jaime Torres Amate adc5f6d3ac wrong name and email address
Summary: This reverts commit 2104d18a67.

Test Plan: revert-hammer

Reviewers:

Subscribers:
2018-08-16 13:48:03 +02:00
Travis CI Bot 2104d18a67 Make this test work again with new uds implementation
Summary:
With the new uds implementation, when some data is meant to replace an old one, it has to use replace() instead of insert() to avoid an assert of data already exists.
Use 3 different entries and only insert().

Test Plan:
before: crash in the uds assert
after: passes the test

Reviewers: #dolphin, #frameworks, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: dfaure, aacid, ngraham, bruns, elvisangelaccio, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D13813
2018-08-16 13:06:06 +02:00
Elvis Angelaccio 2e6798088b Enable test mode in dolphinmainwindowtest
We don't want to use the user configuration files when creating a test
instance of DolphinMainWindow.
2018-06-03 11:24:20 +02:00
Nathaniel Graham 316e476b37 Fix the test that broke after recent changes to the default Places items
Test Plan: `ctest`; all tests pass.

Reviewers: #dolphin, markg

Reviewed By: markg

Subscribers: renatoo, kfm-devel, elvisangelaccio, markg

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D12464
2018-05-31 22:33:31 -06:00
Elvis Angelaccio b9d6a97711 Bundle dolphinui.rc also in dolphinmainwindowtest
Otherwise the test executable will not be able to find the .rc file
while creating a DolphinMainWindow instance.

We also need to force the component name to `dolphin`, otherwise kxmlgui
will default to the name of the binary (which in this case would be
dolphinmainwindowtest rather than dolphin).
2018-04-29 17:07:18 +02:00
Elvis Angelaccio 362244ccbe DolphinTabPage: deactivate secondary view after closing split view
We deactivate the previously active view container whenever we change the active
split view, but we never do the same when we close the split view.

Long term we should probably even delete the secondary view after
closing the split view, because it will never be used again and the
pointer will be overwritten the next time the user opens the split view.
2018-04-25 13:42:18 +02:00