Commit Graph

137 Commits

Author SHA1 Message Date
Felix Van der Jeugt
8db630d358
don't copy values but set dirty 2017-09-19 17:26:03 +02:00
Ryan Roden-Corrent
0286e9ddf2 Fix completion tests after config merge. 2017-08-20 21:12:38 -04:00
Ryan Roden-Corrent
5ea420b49b Fix startup crashes after config merge.
Get qutebrowser to the point where it can at least start

- Declare _messages earlier in MessageView.__init__ so it is set before
  the config trigger tries to access it.
- Remove unused configmodel completion functions
- Move bind completion to configmodel to avoid a circular import with
  the config module
- Fix some config accesses (forgot to use .val)
- Fix old Completion.CompletionKind references
2017-08-09 07:28:22 -04:00
Ryan Roden-Corrent
71b71dbc58 Merge remote-tracking branch 'upstream/master' into HEAD 2017-08-06 18:13:49 -04:00
Florian Bruhin
fba25338be Merge pull request #2295 from rcorre/really_complete
Completion refactor V3
2017-07-21 15:05:43 +02:00
Florian Bruhin
e81dcccace Add a test for a None currentWidget with backforward widget 2017-07-10 09:29:45 +02:00
Florian Bruhin
0e8175b8eb Update docstrings/docs 2017-07-09 23:27:34 +02:00
Daniel Hahler
b3a9e09d6c Add statusline widget for back/forward indicator
Fixes https://github.com/qutebrowser/qutebrowser/issues/2737.
2017-07-09 22:38:44 +02:00
Ryan Roden-Corrent
f9f8900fe9 More sql code review fixes.
- remove outdated comment
- fix sql init error message
- clean up history text import code
- fix test_history file path in coverage check
- use real web history, not stub, for completion model tests
- use qtmodeltester in sql/list_category tests
- test url encoding in history tests
- fix test_clear by using a callable mock
- remove test_debug_dump_history_oserror as the check is now the same as
  for the file not existing
- rename nonempty to data in test_completionmodel
- add more delete_cur_item tests
- test empty option/value completion
2017-07-08 09:57:32 -04:00
Ryan Roden-Corrent
dc4472470e Merge remote-tracking branch 'upstream/master' into really_complete 2017-07-05 08:45:57 -04:00
Florian Bruhin
cff61fa0bc Fix pylint
This also reverts commit 8df0b063be.
2017-07-04 15:34:10 +02:00
Florian Bruhin
f98b8a240e Fix flake8 2017-07-04 15:09:23 +02:00
Florian Bruhin
4495e721d8 Tests and fixes for config.Config 2017-07-04 15:08:03 +02:00
Florian Bruhin
3edebce833 Add tests for :set 2017-07-04 15:08:03 +02:00
Florian Bruhin
725ffef5f3 Use a real config object in unit tests 2017-07-04 15:08:03 +02:00
Florian Bruhin
28670f8e48 Move config.style into config.config and refactor it 2017-07-04 15:08:03 +02:00
Florian Bruhin
81d6406e14 Update test_stylesheet 2017-07-04 15:08:03 +02:00
Florian Bruhin
a5c8a52dd5 Update config_stub for tests 2017-07-04 15:08:03 +02:00
Florian Bruhin
2a40401398 Fix config tests for new Command type 2017-07-04 15:08:03 +02:00
Florian Bruhin
3e3685b68b Initial configexc refactoring 2017-07-02 22:17:33 +02:00
Ryan Roden-Corrent
22880926b1 Fix WebHistoryStub for delete argument change 2017-06-29 21:46:09 -04:00
Ryan Roden-Corrent
f06880c6e2 Fix history completion delete function.
In order to update SqlQueryModel's rowCount after re-running the query,
we must call setQuery again.
2017-06-27 08:42:10 -04:00
Ryan Roden-Corrent
46161c3af0 Refactor delete_cur_item.
Taking the completion widget as an argument was overly complex.
The process now looks like:

1. CompletionView gets deletion request
2. CompletionView passes selected index to CompletionModel
3. CompletionModel passes the row data to the owning category
4. The category runs its custom completion function.

This also fixes a bug. With the switch to the hybrid (list/sql)
completion model, the view was no longer updating when items were
deleted. This fixes that by ensuring the correct signals are emitted.

The SQL model must be refreshed by running the query. We could try using
a SqlTableModel so we can call removeRows instead.

The test for deleting a url fails because qmodeltester claims the length
of the query model is still 3.
2017-06-26 08:57:36 -04:00
Florian Bruhin
994e8c692f Merge different FakeTabbedBrowser objects 2017-06-20 15:19:53 +02:00
Ryan Roden-Corrent
309b6ba32c Move _import_history to history.py.
Also adjusts the history import test to operate at a higher level and
ensure the old text file is removed (or isn't, in the case of an error).
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
882da71397 Remove unused imports 2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
71191f10a2 Only complete most recent atime for url.
The history completion query is extended to pick only the most recent item for
a given url.

The tests in test_models now check for ordering of elements.
2017-06-19 07:44:11 -04:00
Florian Bruhin
c6e31391de Fix most tests/lint 2017-05-10 09:19:24 +02:00
Florian Bruhin
822623f2ed Finally update copyrights... 2017-05-09 21:37:03 +02:00
Florian Bruhin
1d0f187fab Adjustments for new pylint version 2017-04-13 18:22:16 +02:00
Maciej Wołczyk
2fca442892 Fixed TabbedBrowserStub's tabBar, no longer toggling updates while moving tabs 2016-11-30 15:23:35 +01:00
Maciej Wołczyk
e613d01263 Fixed problems with tab completion after moving tabs (#2141) 2016-11-30 14:17:20 +01:00
Florian Bruhin
78d64f4791 Get rid of webkitelem.focus_elem 2016-09-07 11:24:28 +02:00
Florian Bruhin
ee5a972069 Move auto-insert-mode handling to browsertab
This means auto-insert-mode now works correctly with QtWebEngine.
2016-09-07 10:24:27 +02:00
Florian Bruhin
cf7170a33b Remove no longer needed webelem methods
The following methods were only used for hint labels and thus removed
now:

- document_element
- create_inside
- find_first
- set_inner_xml
- remove_from_document
- set_style_property
2016-08-17 14:44:49 +02:00
Florian Bruhin
ad5008152c Move browser.webkit.history to browser.history 2016-08-10 14:45:52 +02:00
Florian Bruhin
c5a363c66c tests: Add requested argument to FakeWebTab.url 2016-08-10 13:54:52 +02:00
Florian Bruhin
029ea2e5a7 Add miscwidgets.WrapperLayout.wrap
This makes it easier for an user of WrapperLayout to wrap a widget.
2016-08-04 19:22:44 +02:00
Ryan Roden-Corrent
a740f99607 Register the fake statusbar command in objreg.
The CompletionView looks in objreg for 'status-cmd', so move it from a
private fixture in test_completer to a public fixture that handles
objreg registration/deletion.
2016-07-28 12:20:24 -04:00
Ryan Roden-Corrent
aedf5b930a Test Completer.schedule_completion_update.
update_completion is only used internally, so instead test the real
public entry point which is schedule_completion_update.

This required mocking out QTimer to fire immediately so the test didn't
have to do flaky artificial delays.
2016-07-28 12:20:24 -04:00
Florian Bruhin
d357ccf403 Add some more WebElementWrapper tests 2016-07-28 14:25:53 +02:00
Florian Bruhin
3ccb691e9f tab API: Rename scroll to scroller
The scroll attribute did overwrite QWidget.scroll which is unfortunate.
2016-07-26 13:19:07 +02:00
Florian Bruhin
3ea6d4c527 Add KeyConfigStub.get_reverse_bindings_for 2016-07-26 12:06:42 +02:00
Florian Bruhin
68f5ed4fa4 tests: Fix FakeWebTabScroller
Pass tab correctly
2016-07-13 13:47:26 +02:00
Florian Bruhin
b791095324 Rename browser.tab module and classes 2016-07-10 17:27:02 +02:00
Florian Bruhin
782561462b Use stubs.FakeWebTab to fake tabs
This also fixes the cur_url access.
2016-07-08 10:09:03 +02:00
Florian Bruhin
09f025628f Use tab.AbstractTab for signals/slots 2016-07-07 18:32:52 +02:00
Florian Bruhin
17466b4f26 Fix some lint 2016-07-07 18:32:52 +02:00
Florian Bruhin
4e5a7a891e tests: Use FakeWebTab for stubbing 2016-07-07 18:32:52 +02:00
Florian Bruhin
115021b8ea Get QtWebEngine to start and work somewhat 2016-07-07 18:32:52 +02:00
Florian Bruhin
ebf9bc4e0a Improve version output 2016-07-06 23:47:59 +02:00
Ryan Roden-Corrent
68e373df44 Use QLineEdit as a base for FakeStatusbarCommand.
Reduces the amount of mocking and keeps it more true to the original.
2016-07-03 23:06:36 -04:00
Ryan Roden-Corrent
7f690c3f3f More unit test coverage for Completer.
Test completion_item{next,prev} and change_completed_part.
2016-07-03 22:58:09 -04:00
Ryan Roden-Corrent
13e8ed53d6 Clean up completer unit test.
Based on code review:

    - import modules, not classes
    - use methods, not lambdas for the mock command prompt class
    - use None rather than Mock for DUMB_SORT
    - autouse two fixtures and remove them from test signatures
2016-07-03 17:18:16 -04:00
Ryan Roden-Corrent
07edcce697 Unit test Completer.update_completion.
Validate update_completion sets the completions widget's model
correctly based on the command text.
2016-07-02 12:25:55 -04:00
Ryan Roden-Corrent
d45acb0388 Eliminate FakeSettingSection/Value.
Don't really need to mock these out for tests as the real classes are
simple enough.
2016-06-30 20:12:44 -04:00
Ryan Roden-Corrent
ee59b133c0 Don't bother mocking a history entry.
Use webkit.history.Entry in tests instead of FakeHistoryEntry.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
f50b8bb8e8 Use iter instead of __iter__.
Corrent two places this was used.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
d6012ad95c Test delete_cur_item more cleanly.
Reduce duplicate code by mocking out a QTreeView around the model and
setting its index.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
b6652ad6bc Test completion quickmark/bookmark deletion.
Validate that quickmarks and bookmarks can be deleted from the url
completion menu.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
409de10fb4 Unit test delete_cur_item for tab completion model. 2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
8321c1a90f Unit test setting value completion 2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
f5b1019d4d Unit test config option completion.
Had to add the `raw` parameter to ConfigStub.get as the setting option
completion model passes this argument explicitly (although the docs say
only raw=True is supported).
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
16f043034f Unit test tab (buffer) completion.
This involved adding a few stubs as well as expanding the FakeWebView.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
610f9b7068 Unit test session completion 2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
baf8d00a20 Unit test url/quickmark/bookmark completion.
This also adds a few more stubs/fakes to mock out the
quickmark-manager, bookmark-manager, and web-history objects.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
b037ec489f Add unit tests for help completion.
Also adds a FakeConfigSection stub for stubbing out configdata.DATA.
2016-06-30 07:26:02 -04:00
Ryan Roden-Corrent
555bdb75b5 Add unit test for CommandCompletionModel.
This establishes a pattern that can probably be used to test any of the
completion models.

See #999.
2016-06-30 07:26:02 -04:00
Florian Bruhin
4fccc89d7d Split browser into browser/browser.webkit 2016-06-13 11:18:21 +02:00
Daryl Finlay
054e9ab439 Add host placeholder to window and tab title formats 2016-06-10 21:59:43 +01:00
Florian Bruhin
10630e30ab hints: Integrate _get_first_rectangle into webelem 2016-06-06 11:56:15 +02:00
Ryan Roden-Corrent
581a521b4d Allow setting mock keybindings for unit tests.
Implement mock_key_config.set_bindings_for to set bindings that will be
retrieved by mock_key_config.get_bindings_for.
This is useful for testing the new keyhint ui.
2016-05-15 22:18:16 -04:00
Florian Bruhin
a5f2ac5f03 Adjust copyright years. 2016-01-04 07:12:39 +01:00
Florian Bruhin
59c8e5c3d1 Add some tests for commands.userscripts. 2015-12-21 08:45:46 +01:00
Florian Bruhin
150a83d8f4 pylint: Remove unneeded supressions. 2015-12-01 22:03:58 +01:00
Daniel
0851999b89 Add unit/regression test 2015-10-23 19:52:56 +02:00
Florian Bruhin
d5baed5e83 Merge branch 'cookies_tests' of https://github.com/acogneau/qutebrowser into acogneau-cookies_tests 2015-09-16 22:58:28 +02:00
Alexander Cogneau
418328e61b Cookie tests done 2015-09-03 18:17:39 +02:00
Alexander Cogneau
96e3a0b1f1 first cookie tests 2015-09-03 17:24:01 +02:00
Florian Bruhin
18af0b4b35 tests: Make FakeSignal callable. 2015-09-02 23:32:06 +02:00
Florian Bruhin
8ea91b5bbc Fix cookiejar_and_cache move. 2015-08-31 08:00:21 +02:00
Florian Bruhin
6df00f8266 Move cookiejar_and_cache fixture to conftest.py. 2015-08-30 23:11:23 +02:00
Florian Bruhin
7bc5996d52 tests: Provide activeWindow() in FakeQApplication. 2015-08-23 21:55:25 +02:00
Florian Bruhin
b11e075047 Add __getitem__ to ConfigStub. 2015-08-19 20:39:48 +02:00
Florian Bruhin
1ddd65304a tests: Use a real signal for ConfigStub. 2015-08-19 19:37:19 +02:00
Florian Bruhin
e4a0f1972f tests: Improve MessageMock and use it. 2015-08-18 21:38:18 +02:00
Florian Bruhin
2c5269acd6 Reorganize tests directory. 2015-08-18 20:19:02 +02:00