Commit 8c218bc7 authored by Sven Zimmer's avatar Sven Zimmer

more tests and abbot 1.2 in maven

parent 4499c9be
......@@ -78,11 +78,9 @@
<version>1.7</version>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-abbot-plugin</artifactId>
<version>1.2</version>
<scope>system</scope>
<systemPath>/informatik2/students/home/3zimmer/software/abbot-1.2.0/lib/abbot.jar</systemPath>
<groupId>com.github.WojtekKowaluk</groupId>
<artifactId>abbot</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>
<repositories>
......
......@@ -91,10 +91,9 @@ public class DepTreeDisplayInteractor extends AbstractDisplayInteractor {
.newSingleThreadScheduledExecutor();
private static ExecutorService _executorServiceParsing = Executors
.newSingleThreadScheduledExecutor();
public DepTreeDisplayInteractor() {
setupWorkingDirs();
_dtI = new DepTreeInteractor();
_dtI.addPopupListener(new PopupListener() {
@Override
......@@ -106,6 +105,7 @@ public class DepTreeDisplayInteractor extends AbstractDisplayInteractor {
public void setIndex(int index) {
}
});
_nav.addNavSelectListener(new NavSelectListener() {
@Override
public void navNodeSelected(NavSelectEvent e) {
......@@ -372,6 +372,10 @@ public class DepTreeDisplayInteractor extends AbstractDisplayInteractor {
return decorate(parse, parser);
}
/**
* Exports the parse of the currently displayed DepTree as a SVG file. Its name is chosen by the user in a window.
*
*/
public void saveSVG() {
// bug: formating
File file = selectFile("svg", true);
......@@ -407,7 +411,7 @@ public class DepTreeDisplayInteractor extends AbstractDisplayInteractor {
}
/**
* save the parse of the currently displayed DepTree into a CDA file of the
* Saves the parse of the currently displayed DepTree into a CDA file of the
* actual name
*/
protected void saveCDA() {
......@@ -871,19 +875,19 @@ public class DepTreeDisplayInteractor extends AbstractDisplayInteractor {
*/
public class DepTreeDisplayParsingRun implements Runnable {
private DepTreeDisplayInteractor gui;
private ArrayList<String> input;
private ArrayList<String> lastInput;
private DepTreeDisplayInteractor _dtDI;
private ArrayList<String> _input;
private ArrayList<String> _lastInput;
public DepTreeDisplayParsingRun(ArrayList<String> input, ArrayList<String> lastInput, DepTreeDisplayInteractor gui) {
this.input = input;
this.lastInput = lastInput;
this.gui = gui;
this._input = input;
this._lastInput = lastInput;
this._dtDI = gui;
}
@Override
public void run() {
gui.parse(new ArrayList<String>(), input, lastInput, true);
_dtDI.parse(new ArrayList<String>(), _input, _lastInput, true);
}
}
......@@ -895,18 +899,18 @@ public class DepTreeDisplayInteractor extends AbstractDisplayInteractor {
*/
public class DepTreeDisplayDrawParseRun implements Runnable {
private Parse parse;
private DepTreeDisplayInteractor gui;
private Parse _parse;
private DepTreeDisplayInteractor _dtDI;
public DepTreeDisplayDrawParseRun(Parse parse, DepTreeDisplayInteractor gui) {
this.parse = parse;
this.gui = gui;
this._parse = parse;
this._dtDI = gui;
}
@Override
public void run() {
DecoratedParse decoratedParse = (DecoratedParse) parse;
gui.draw(decoratedParse);
DecoratedParse decoratedParse = (DecoratedParse) _parse;
_dtDI.draw(decoratedParse);
}
}
......
......@@ -195,13 +195,13 @@ public class DepTreeGenerator {
}
/**
* Sets the y position of the nodes. The first time buildForest is called,
* Sets the y position of the nodes. The first time setYPositions is called,
* forestTODO contains the nodes that are roots and restTODO contains the
* rest. It then traverses each tree starting from each root by removing all
* nodes linking to it from restTODO and putting them into forestTODO, while
* setting their y one level below it, then repeating that for those nodes
* and so on. The nodes left afterwards are in circles (or linking to them).
* Each time buildForest is called afterwards, forestTODO contains one of
* Each time setYPositions is called afterwards, forestTODO contains one of
* those nodes in circles and restTODO the ones that haven't been removed
* yet. It then traverses the circle starting from that node as above until
* no nodes are left. If the node in the parameter forestTODO was a node in a
......
......@@ -865,7 +865,7 @@ public class AbbotTestDepTreeViewer extends ComponentTestFixture {
// assertTrue(node.getWord() + " should have been selected", ((Element) node.getElement(type, _dt.getCurrentLevel()).getParentNode()).getAttribute("stroke").equals(_dt.getSelectColor()));
// }
// }
// _ct.actionDelay(1000);
// _ct.actionDelay(1000);
}
return new MainPage();
}
......@@ -909,6 +909,8 @@ public class AbbotTestDepTreeViewer extends ComponentTestFixture {
(int) secondTargets.get(1).getX(),
(int) secondTargets.get(1).getY(),
InputEvent.BUTTON3_MASK);
// DepTreeNode node = pointToNode(firstTargets.get(0));
// assertTrue("Link should have been changed.", true );
secondTargets = getClickablePoints(type, secondLevel);
_ct.actionClick(canvas,
(int) secondTargets.get(2).getX(),
......@@ -921,6 +923,31 @@ public class AbbotTestDepTreeViewer extends ComponentTestFixture {
return new MainPage();
}
/**
* Finds the DepTreeNode that has an graphic element at certain coordinates in the DepTree
*
* @param point the coordinates where to look
* @param type the type of the graphical element
* @param level the level of the graphical element
* @return the node if found, null otherwise
*/
private DepTreeNode pointToDTNode(Point point, Elem type, String level) {
DepTreeNode result = null;
for (DepTreeNode node : _dt){
if (point.equals(dtNodeToPoint(node, type, level))){
result = node;
}
}
return result;
}
private Point dtNodeToPoint( DepTreeNode node, Elem type, String level) {
// String xAttribute = "x";
// String yAttribute = "y";
// Point result = new Point(getAttribute(node, type, level, xAttribute), getAttribute(node, type, level, yAttribute));
return null;
}
public MainPage changeRandomDTLinkToRoot(String action, String target) {
Elem type = StringToElem(target);
String level = StringToLevel(target);
......
......@@ -149,7 +149,7 @@ public class AutoTestDepTreeViewer {
// .moveEachScrollbar()
// implemented
// .generateRandomDTREFLink()
.generateRandomDTREFLink()
// implemented
// .selectRandomInDT(Elem.LINE, "SYN")
......@@ -163,10 +163,10 @@ public class AutoTestDepTreeViewer {
// .selectRandomDTWord()
// // implemented
// .changeRandomDTLink("click","dot","SYN")
// .changeRandomDTLink("click","word","SYN")
// .changeRandomDTLink("click","dot","REF")
// .changeRandomDTLink("click","word","REF")
.changeRandomDTLink("click","dot","SYN")
.changeRandomDTLink("click","word","SYN")
.changeRandomDTLink("click","dot","REF")
.changeRandomDTLink("click","word","REF")
// not
// .changeRandomDTLink("drag","dot")
// .changeRandomDTLink("drag","word")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment