Commit Graph

379 Commits

Author SHA1 Message Date
Sergio Martins
8427cd7f5f tests: Don't spam so many qpa warnings
We don't care about these warnings so don't print them
2019-07-19 18:16:47 +01:00
Sergio Martins
cbef097bec Improve MultiSplitterLayout::clear()
To be used by LayoutSaver before restoring
2019-07-19 12:18:46 +01:00
Sergio Martins
963e566cda Ensure test doesn't leave windows open 2019-07-19 11:57:47 +01:00
Sergio Martins
48ae1b5feb Add some simplifications 2019-07-18 22:30:17 +01:00
Sergio Martins
c430d40b0b Uncomment test that passes now 2019-07-18 22:04:48 +01:00
Sergio Martins
f6259430a7 Variable renaming for readability 2019-07-17 23:02:39 +01:00
Sergio Martins
af94a5da6d Added a needed debug to compare output between two shas 2019-07-17 22:11:18 +01:00
Sergio Martins
24dfb34a6f Less DropArea qobject_casts 2019-07-17 22:05:12 +01:00
Sergio Martins
98e47856f3 tests: Simply getting the drop area
No need for casts
2019-07-17 21:32:45 +01:00
Sergio Martins
16e99dac8b Fix rectForDrop() when one of the sides didn't have more space
The layout guarantees that there's enough space for the widget
and for the new anchor, but doesn't say in which side the new
anchor should steal space from, so bound the rect when we finish
calculating it

Finally we can uncomment the warning in Anchor::setPosition() to
detect out of bounds cases, tests pass now with no warning
2019-07-17 17:59:20 +01:00
Sergio Martins
e3f49653c3 Fix typo in rectForDrop(), found by unit-test 2019-07-17 15:47:47 +01:00
Sergio Martins
6d5116f7cf tests++ 2019-07-17 14:55:21 +01:00
Sergio Martins
f65fdef13e tests: More tests for rectForDrop() 2019-07-17 12:03:45 +01:00
Sergio Martins
9fe0a191eb Remove unneeded test, in the hope of removing MultiSplitterLayout::resizeItem()
which is not the correct way to resize items
2019-07-17 11:46:51 +01:00
Sergio Martins
fc380eab72 More tests for rectForDrop() 2019-07-17 11:46:42 +01:00
Sergio Martins
2b45aab88d Propagate closing events
FloatingWindow now asks Frame if it should close
Frame asks its DockWidgets
DockWidget asks its widget
2019-07-16 22:36:08 +01:00
Sergio Martins
0abc315584 Share some tests code in utils.cpp 2019-07-16 22:13:22 +01:00
Sergio Martins
cff487099d Add missing override 2019-07-16 21:39:51 +01:00
Sergio Martins
3c4dba77bf Add tests/utils.h
tst_docks.cpp is becoming too big
2019-07-16 21:38:45 +01:00
Sergio Martins
007f483069 Support re-docking a frame with multiple dock widgets 2019-07-16 14:42:43 +01:00
Sergio Martins
b6c0353f7b Fix anchor following not being updated when an item is removed 2019-07-16 11:54:20 +01:00
Sergio Martins
4a0bd209b8 Fix ASSERT in Anchor::setFollower() 2019-07-15 23:44:35 +01:00
Sergio Martins
a848810239 Add a failing test 2019-07-15 23:19:03 +01:00
Sergio Martins
8a6758c93d Fix buggy Anchor::findNearestAnchorWithItems()
It was returning inside the loop, instead of honouring the candidate
2019-07-15 22:46:27 +01:00
Sergio Martins
0eb746ad22 Uncomment test that passes 2019-07-15 20:12:27 +01:00
Sergio Martins
1cdf9e1c9a Add unit-test for checking that widgets preserve position after restored 2019-07-15 16:57:40 +01:00
Sergio Martins
8d31bb85fa Fix clazy warnings 2019-07-15 13:10:17 +01:00
Sergio Martins
c96eb88023 Fix choosing which anchors to move when restoring placeholders 2019-07-15 00:16:58 +01:00
Sergio Martins
0aac8edb0c Fix off by ones in rectForDrop()
It was accounting for the anchor thickness
2019-07-14 21:39:11 +01:00
Sergio Martins
d05c1adcd7 tests: Allow EventFilter wait for any event 2019-07-14 20:14:42 +01:00
Sergio Martins
c1563b6f86 Fix bug where widget didn't have the correct size after restored
Because the anchor already had the correct position it wouldn't
update the widget size
2019-07-14 18:32:19 +01:00
Sergio Martins
5fe3d72732 Clean windows at end of test 2019-07-14 17:07:57 +01:00
Sergio Martins
320556c775 Add a failing unit-test
The widget isn't being resized
2019-07-14 16:56:13 +01:00
Sergio Martins
e30d6ecf8d fuzzer: escape strings 2019-07-14 14:24:07 +01:00
Sergio Martins
c7f0eb704a Abstract widgets min sizes behind Item
The layout now only consults Item for the min size, never
the widgets directly. The reason is Item in the future will have
to detect the widget's min size changing, so it's better encapsulated
this way. Also decouples the layout from QWidget a bit, so in the future
we can support QML

The direct consequence is fixing the warnings about size constraints
not being honoured, due to widget getting different min size and we not
resizing
2019-07-14 14:20:11 +01:00
Sergio Martins
353dc4474c Fix restoring a floating window in some cases
MultiSplitterLayout::unrefOldPlaceholders() was clear all placeholder
references for that dock widget, but when using addMultiSplitter()
we don't create a new Item, we just steal the Items from the source
multi splitter, so we need to preserve those refs

Added unit-test
2019-07-14 13:08:24 +01:00
Sergio Martins
8fdb6fb5de Improve failing test 2019-07-13 13:39:43 +01:00
Sergio Martins
8d2206c137 Add a comment 2019-07-13 12:59:59 +01:00
Sergio Martins
f55f90e575 Remove wrong assert, the Item can be still being refed by other widgets
Like dock widgets that where set floating and remember their previous
positions. The item will only be deleted if refcount is 0
2019-07-13 12:57:06 +01:00
Sergio Martins
bb59b3bedb Add a failing test 2019-07-13 12:45:53 +01:00
Sergio Martins
105bb6770b Add a failing test for a feature we don't support yet
When adding a dock widget to a tab we don't check its minimum size
and we don't resize the layout, yet.
2019-07-13 03:01:53 +01:00
Sergio Martins
7709803e57 Make the setFollowee() stuff much simpler
It was getting quite crazy to figure out which anchors to follow
when restoring dock widgets in complex layouts full of hidden items.

Now, the approach is much simpler, we just call setFollowee(nullptr)
on all anchors, then swipe left and right, top and bottom and
set the anchors that really need to follow
2019-07-12 12:58:11 +01:00
Sergio Martins
abafa49492 fuzzer: minor style fixes and add Laurent as author 2019-07-12 11:20:15 +01:00
Laurent Montel
30a04e1d13 Add test application for generating random dockwidget for testing potential bugs 2019-07-12 11:57:20 +02:00
Sergio Martins
f0e9a4f1bc Add another failing test 2019-07-11 14:10:25 +01:00
Sergio Martins
b4864d156f Don't assert that the group is squashed
It can happen
2019-07-11 14:02:11 +01:00
Sergio Martins
e5fbbdae6c Improve finding the right anchors for restoring placeholders 2019-07-11 12:58:35 +01:00
Sergio Martins
dab0694dbc Introduce Anchor::findNearestAnchorWithItems()
As a cleaner alternative than abusing AnchorGroup::turnIntoPlaceholder()
as the item was already a placeholder
2019-07-10 19:11:10 +01:00
Sergio Martins
90502ae5c7 When adding widgets relative to placeholders don't forget to set following 2019-07-10 18:24:33 +01:00
Sergio Martins
91704fd486 Uncomment a few tests that are passing 2019-07-10 16:39:30 +01:00