Hi,
Also I don't get this test:
testScope3
"Edges are defined in a forEach:"
| edge |
view interaction popupText.
view nodes: #(1 2) forEach: [:each |
view nodes: #(1 2).
view edges: {each}
from: 1
to: 2
fromGlobal: false
toGlobal: true ].
window := view open.
self assert: (view root edges size = 2).
self assert: (view root nodes first edges isEmpty).
self assert: (view root nodes second edges isEmpty).
edge := view root nodes first edges first.
self assert: (edge source == view root nodes first nodes first).
self assert: (edge target == view root nodes second).
edge := view root nodes second edges first.
self assert: (edge source == view root nodes second nodes first).
self assert: (edge target == view root nodes second).
How can we say in the second assertion "view root nodes first edges isEmpty" than try to recover the edge from the node with
edge := view root nodes first edges first.
So what about:
edge := view root edges first.
Cheers,
Fabrizio
Hi Doru,
thanks really a lot, now the problem is fixed indeed. The failing tests you are referring to have all the common problem that either the edge it is not assign to the node or the node has a different edge inside:
Ex.
testInnerEdgeContainsPoint
| nodes domainNodes assoc edge edgeBound root |
view shape rectangle size: 50.
nodes :=view nodes: #(1 2) forEach:[:e |
view nodes: #(3 4).
view interaction
item: 'inspect' action: #inspect.
edge := view edge: 3->4 from: #key to: #value].
window := view open.
edgeBound := edge shape computeBoundsFor: edge.
self assert: (edgeBound = ( 30@12 corner: 70@12)).
"--------"
"Check how many elements"
self assert: (view root allEdges size = 2).
self assert: (view root allNodes size = 6).
self assert: (view root elementsToDisplay size = 8).
"--------"
"--------"
"MORoot>>elementAt:"
root := nodes first root.
self assert: (root isRoot).
self assert: (root elementAt: (edge shape computeBoundsFor: edge) center) == edge.
"--------"
in this case "(root elementAt: (edge shape computeBoundsFor: edge) center)" return an edge which is the same as "edge" (3->4) but it is a different object. A comment in elementAt:ifNone: says: "Answer the element at aPoint or evaluate aBlock if none. Note that this implementation assumes that children are always fully contained within their owner and is therefore very efficient."
I think we should not fix the test but this method although I don't know how.
Cheers,
Fabrizio2012/5/26 Tudor Girba <tudor@tudorgirba.com>
Hi Fabrizio.
Thanks for helping me reproduce the problem.
It should be fixed now.
However, there are still some red tests because they assume the old wrong behavior of assigning edges to an owner node.
Cheers,
Doru
On 26 May 2012, at 15:28, Fabrizio Perin wrote:
> Hi Doru,
> Here is the code you were working on:
>
> view := MOViewRenderer new.
> view nodes: #(2) forEach: [:each |
> view shape label.
> view node: each* 10.
> view shape label.
> view node: (each * 10 + 1).
> view treeLayout.
> ].
> view edgesFromAssociations: {"10->20. 10 -> 11 ." 20->21}.
> view open.
>
> Cheers,
> Fabrizio
--
www.tudorgirba.com
"It's not what we do that matters most, it's how we do it."
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev