mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N.788 Impact analysis: graph not refreshed when trying to filter out some classes. The node removal algorithm has been improved in two places. 1) Do not create loops (i.e. an edge having both ends on the same node) when removing a node. 2) Correctly cleanup nodes having a loop (in case there is a loop in the original graph (defensive programming)
SVN:trunk[4644]
This commit is contained in:
@@ -5545,3 +5545,53 @@ class TestBug609 extends TestBizModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TestBug788 extends TestBizModel
|
||||
{
|
||||
static public function GetName()
|
||||
{
|
||||
return 'Graph - delete nodes';
|
||||
}
|
||||
|
||||
static public function GetDescription()
|
||||
{
|
||||
return '(N.788) Graph not refreshed when unchecking some classes';
|
||||
}
|
||||
|
||||
protected function DoExecute()
|
||||
{
|
||||
$oGraph = new SimpleGraph();
|
||||
$a = new GraphNode($oGraph, 'A');
|
||||
$b = new GraphNode($oGraph, 'B');
|
||||
$c = new GraphNode($oGraph, 'C');
|
||||
new GraphEdge($oGraph, 'A--B', $a, $b);
|
||||
new GraphEdge($oGraph, 'B--C', $b, $c);
|
||||
new GraphEdge($oGraph, 'C--B', $c, $b);
|
||||
|
||||
echo "<h5>Graphe initial</h5>";
|
||||
echo $oGraph->DumpAsHtmlImage();
|
||||
echo $oGraph->DumpAsHTMLText();
|
||||
|
||||
echo "<h5>Removing C</h5>";
|
||||
$oGraph->FilterNode($c);
|
||||
unset($c);
|
||||
echo $oGraph->DumpAsHtmlImage();
|
||||
echo $oGraph->DumpAsHTMLText();
|
||||
|
||||
if ((count($oGraph->_GetNodes()) != 2) || (count($oGraph->_GetEdges()) != 1))
|
||||
{
|
||||
throw new Exception('The graph should be made of 2 nodes and 1 edge');
|
||||
}
|
||||
|
||||
echo "<h5>Removing B</h5>";
|
||||
$oGraph->FilterNode($b);
|
||||
unset($b);
|
||||
echo $oGraph->DumpAsHtmlImage();
|
||||
echo $oGraph->DumpAsHTMLText();
|
||||
|
||||
if ((count($oGraph->_GetNodes()) != 1) || (count($oGraph->_GetEdges()) != 0))
|
||||
{
|
||||
throw new Exception('The graph should contain only the node A');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user