summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsanchorlayout
Commit message (Collapse)AuthorAgeFilesLines
* After some discussion we decided to remove hasConflicts() from the API.Jan-Arve Sæther2009-09-291-33/+19
| | | | | | | | hasConflicts() does only make sense for a tool/editor of the layout, and how this function would help the tool is only guesswork at the moment. We keep the private API though, in order to let the autotests we inherited from Orbit pass.
* QGraphicsAnchorLayout: Enable boundary feasibility testEduardo M. Fleury2009-09-251-4/+2
| | | | | | | | This test would trigger random Q_ASSERT failures but should work fine after the previous commit. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
* QGraphicsAnchorLayout: Adding hasConflicts() verifications on anchor testsJesus Sanchez-Palencia2009-09-251-0/+29
| | | | | Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* QGraphicsAnchorLayout: Removing memory leaks on anchor testsJesus Sanchez-Palencia2009-09-251-0/+12
| | | | | Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* Add test for to see if the layout is stable if it has several solutions.Jan-Arve Sæther2009-09-231-6/+59
| | | | Currently this fails, so we have to use QEXPECT_FAIL.
* QGraphicsAnchorLayout: Added an auto test for size policyAnselmo Lacerda S. de Melo2009-09-181-0/+86
| | | | | | | | | | Added an auto test for the currently supported size policies set. This is a simple test containing a single item anchored to the layout vertical and horizontally. The size policies are set, then the item's minimum, preferred and maximum sizes are compared to the expected ones, according to each policy. Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
* Implement hasConflicts().Jan-Arve Sæther2009-09-171-1/+43
|
* Test if the direction influences the returned graphics anchor object.Jan-Arve Sæther2009-09-151-1/+7
| | | | Pointed out by Caio.
* API change. This will get rid of the ugly setAnchorSpacing() method.Jan-Arve Sæther2009-09-141-118/+68
| | | | | | | | | | | | | | | | | | | | Say hello to QGraphicsAnchor, move the spacing (and removeAnchor) functionality over to that class. This also opens up for a cleaner API when we add support for size policies or min/pref/max sizes for anchors. Also remove - addLeftAndRightAnchors() - addTopAndBottomAnchors() - addAllAnchors() in favor of - addAnchors(itemA, itemB, Qt::Orientations) API change discussed with Caio and Andreas. Reviewed-by: Alexis
* Respect the layoutDirection property of the parent widget.Jan-Arve Sæther2009-09-111-0/+78
| | | | | | | Add a layoutDirection autotest, and sprinkle some of the tests with checkReverseDirection() Reviewed-by: Eduardo M. Fleury
* Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | Reviewed-by: Trust Me
* Add some more tests for anchor layoutJan-Arve Sæther2009-09-021-1/+164
|
* Update tech preview license header for files that are new in 4.6.Jason McDonald2009-08-311-13/+13
| | | | Reviewed-by: Trust Me
* Fix some missing and duplicated license headers.Jason McDonald2009-08-271-0/+41
| | | | Reviewed-by: Trust Me
* update API to what was agreed on the API review meeting yesterday:Jan-Arve Sæther2009-08-191-134/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | The changes are: * Move enums in QGraphicsAnchorLayout::Edge to Qt::AnchorPoint. Prefix them with Anchor since they are not edges in general. * Rename anchor() to addAnchor() * Rename anchorCorner() -> addCornerAnchors() * Rename anchorWidth() -> addLeftAndRightAnchors() * Rename anchorHeight() -> addTopAndBottomAnchors() * Rename anchorGeometry() -> addAllAnchors() * remove the overloads that take a spacing argument, and add setAnchorSpacing() to accommodate for that. * Added anchorSpacing() (implementation missing) * Added unsetAnchorSpacing(). (implementation missing) * made sizeHint() protected. Updated all examples and autotest to reflect this API change.
* Fix one "failure" on the mac.Jan-Arve Sæther2009-08-191-0/+3
| | | | This failed on Alexis' Mac Mini (Leopard)
* QGraphicsAnchorLayout: fix calculation of sizeAt* values for SequentialCaio Marcelo de Oliveira Filho2009-08-181-4/+2
| | | | | | | | | | | | | | | | | | | | | This commit implements what's described in the previous commit QGraphicsAnchorLayout: fix expected values for parallel test When filling the sizeAt* values (the three points used for interpolation when setting geometry), now sequential anchors distribute the sizes to the children in a fair way, i.e. proportionally in relation to the existing min/pref/max hints. Each value is defined in relation of the pref (either as a shrinkage in pref or a grow in pref). In both cases the shrinking/growing factor is the same for all children. When we implement support for QSizePolicies, this distribution might be changed by setting size policies for a certain item or anchor. This makes two tests work -- so no more expected fail. Also fixed a typo in one test's expected results.
* QGraphicsAnchorLayout: add names to items in examplesCaio Marcelo de Oliveira Filho2009-08-171-33/+33
| | | | | Having the items named helps when using debugging functions to identify the anchors. Cause no harm to add them to the tests.
* QGraphicsAnchorLayout: calculate vertex positions with simplified graphCaio Marcelo de Oliveira Filho2009-08-171-1/+0
| | | | | | | | | | | | | | | | When traversing the graph looking for calculating the distances, also enter inside the complex edges to find (and calculate) the distances for the vertices that were simplified. This require a little tweak in the traversal, now we can't always skip an edge when both vertices are already visited, because complex anchors can hide vertices inside (a sequential anchor in practice remove vertices from the full graph). As a bonus we now pass on the 'example' test (as expected) and the example now works fine. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* More tests for setSpacingJan-Arve Sæther2009-08-171-0/+15
|
* Add autotest for setSpacing()Jan-Arve Sæther2009-08-171-0/+42
|
* Added QEXPECT_FAIL, for tests that we must fix, but we know they fail.Jan-Arve Sæther2009-08-141-0/+3
|
* QGraphicsAnchorLayout: fix expected values for parallel testCaio Marcelo de Oliveira Filho2009-08-131-40/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We changed the parallel example because the expected values for preferred size are wrong. Before we had a parallel anchor ("d|e") that should have the maximum preferred of the both children, so this end up being 170. This parallel is in a sequence with another item ("b") with a preferred of 150 ending up with 320. This group is in parallel with "c" that has a maximum of 300. So in the preferred size of the layout, the group was constraint to 300, which would be proportionally distributed between "b" and "d|e", and 50%/50% as the test expected. The proportional distribution is a feature and we changed the test to illustrate that more. We gave a bump in "c" maximum to 350 and "b" maximum to 300, so the preferred is 100% for both "b" and "d|e", and the proportional feature shows up in the maximum allocation, which is not 100% for the group (b and d|e). In the group, the maximum possible is 500 but the layout only allows 350, so the sizes need to be proportionally, but in relation not to zero, but to the preferred which is 320 (this is the same logic used for setGeometry()). So the growth is 30 / (500 - 320) = 30 / 180 = 1/6. This 1/6 should be the factor given to the children (b and d|e), taking their preferred sizes as starting points. Note that the test still fails, but serve as a milestone to see when the feature is correct implemented. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
* QGraphicsAnchorLayout: test for proportional distributionCaio Marcelo de Oliveira Filho2009-08-131-0/+62
| | | | | | | | | | This test (which fails right now) check whether a sequential anchor is distributing proportionally the size between its parts. This should pass when we make calculateVertexPositions() work together with the simplified graph. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
* QGraphicsAnchorLayout: add a few more testsCaio Marcelo de Oliveira Filho2009-08-131-0/+266
| | | | | | | | | | | | | | | | | | | | | | Adding tests that were helpful during debugging simplification - example: a replica of the anchorlayout example, which has a few interesting cases. - parallel2: a small pararell test case, subset of example. - snakeOppositeDirections: snake but with connections in the opposite directions (this will end up with anchors with opposite directions). - fairDistributionOppositeDirections: same as before, but in the end, this should be taken care by our API which makes internally the same as fairDistribution. Some work on adding QCOMPARE() statements may still be needed for this examples. Note that is interesting to notice (maybe we can make this available for the test checking automatically) whether the simplex is being used or not when simplification is active. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* Add QGraphicsLayout::anchor() overloads and query the default spacing.Jan-Arve Sæther2009-07-221-54/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes several related issues: 1. QGAL::anchor() had a spacing argument that defaulted to 0. That made it impossible to know if the user meant that the spacing should be 0 or if the spacing should be picked from the style. Instead we have to overload anchor, so now we have one function that does not take spacing as an argument. That one will create an anchor where the spacing is queried from the style. The other overload allows the user to explicitly set the spacing, thus the default spacing is ignored. 2. Make sure we pick up the spacing correctly from the style if needed. setAnchorSizeHintsFromDefaults() will set the correct spacing on anchors that was created without specifying a spacing value. 3. Add QGAL::anchor(Qt::Corner, ...) convenience function with an overload (for the same reason as explained in 1.) 4. Added QGraphicsAnchorLayoutPrivate::anchor() as a helper function that is called from all the 4 public API anchor() functions so that we don't need to have duplicate code for argument checking etc. 5. Fix autotests. They assumed that anchor() without a spacing argument created a spacing of 0.
* QGraphicsAnchorLayout: Adding auto-testsJesus Sanchez-Palencia2009-07-222-0/+354
Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org> Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>