Skip to content

Commit

Permalink
Merge pull request #1748 from mtbc/insight-ui-tests-image-name
Browse files Browse the repository at this point in the history
fix OMERO-merge-robotframework-develop with image name adjustment
  • Loading branch information
jburel committed Nov 14, 2013
2 parents 0a414bf + 9059f9c commit c0c0778
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,19 +322,19 @@ public boolean matches(TreePath treepath, Component component, Object node) {

/**
* <table>
* <td>Get Tree Path With Icon And Suffix</td>
* <td>Get Tree Path With Icon And Name</td>
* <td>name of the sought node's image icon</td>
* <td>required suffix of the sought node's text</td>
* <td>name of the sought node</td>
* <td><code>JTree</code> component name</td>
* <table>
* @param iconName the name of the icon sought among the tree nodes
* @param nodeSuffix the suffix of the sought node's text
* @param nodeName the name of the sought node
* @param treeName the name of the tree among whose nodes to search
* @return a tree path from the tree whose node matches the given criteria
* @throws MultipleComponentsFoundException if multiple suitable components have the given name
* @throws ComponentNotFoundException if no suitable components have the given name or no suitable node can be found
*/
public String getTreePathWithIconAndSuffix(final String iconName, final String nodeSuffix, final String treeName)
public String getTreePathWithIconAndName(final String iconName, final String nodeName, final String treeName)
throws ComponentNotFoundException, MultipleComponentsFoundException {
final JTree tree = (JTree) new BasicFinder().find(new Matcher() {
public boolean matches(Component component) {
Expand All @@ -344,9 +344,8 @@ public boolean matches(Component component) {
final TreeNodeMatcher matcher = new TreeNodeMatcher() {
@Override
public boolean matches(TreePath treePath, Component component, Object node) {
final String nodeText = treeNodeTextExtractor.getText(node, treePath);
return nodeText != null && nodeText.endsWith(nodeSuffix) &&
iconName.equals(IconCheckLibrary.getIconNameMaybe(component));
return nodeName.equals(treeNodeTextExtractor.getText(node, treePath)) &&
iconName.equals(IconCheckLibrary.getIconNameMaybe(component));
}};
return findInTree(matcher, tree);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,9 @@ int next() {
private static Component componentFinder(final String panelType, final String imageFilename)
throws ComponentNotFoundException, MultipleComponentsFoundException {
return new BasicFinder().find(new Matcher() {
private final String soughtName = panelType + " for " + imageFilename;
public boolean matches(Component component) {
if (component instanceof JPanel) {
final String name = component.getName();
return name != null && name.startsWith(panelType + " for ") && name.endsWith("/" + imageFilename);
}
return false;
return component instanceof JPanel && this.soughtName.equals(component.getName());
}});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ Blank Thumbnails
Expand Browser project
${image icon name}= Get Insight Image Icon Name treeviewer IMAGE
:FOR ${image name} IN @{normal images}
\ Get Tree Path With Icon And Suffix ${image icon name} /${image name} project tree
\ Get Tree Path With Icon And Name ${image icon name} ${image name} project tree
\ Thumbnail Should Not Be Blank ${image name}
:FOR ${image name} IN @{blank images}
\ Get Tree Path With Icon And Suffix ${image icon name} /${image name} project tree
\ Get Tree Path With Icon And Name ${image icon name} ${image name} project tree
\ Thumbnail Should Be Blank ${image name}

Rendered Thumbnails
Expand All @@ -36,5 +36,5 @@ Rendered Thumbnails
Expand Browser project
${image icon name}= Get Insight Image Icon Name treeviewer IMAGE
:FOR ${image name} IN @{normal images}
\ Get Tree Path With Icon And Suffix ${image icon name} /${image name} project tree
\ Get Tree Path With Icon And Name ${image icon name} ${image name} project tree
Thumbnail Images Should Differ @{normal images}
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,28 @@ Tree Thumbnail Synchronization
[Documentation] check that selection is synchronized between project tree and data browser
Select Window tree viewer window
Expand Browser project
${image icon name}= Get Insight Image Icon Name treeviewer IMAGE
${first tree path}= Get Tree Path With Icon And Suffix ${image icon name} /${first image} project tree
${second tree path}= Get Tree Path With Icon And Suffix ${image icon name} /${second image} project tree
Click On Tree Node project tree ${first tree path}
${selected border color}= Get Thumbnail Border Color ${first image}
${unselected border color}= Get AWT Color util.ui.border.FrameBorder.DEFAULT_COLOR
Should Not Be Equal ${selected border color} ${unselected border color}
${image icon name}= Get Insight Image Icon Name treeviewer IMAGE
${first tree path}= Get Tree Path With Icon And Name ${image icon name} ${first image} project tree
${second tree path}= Get Tree Path With Icon And Name ${image icon name} ${second image} project tree
Click On Tree Node project tree ${first tree path}
${selected border color}= Get Thumbnail Border Color ${first image}
${unselected border color}= Get AWT Color util.ui.border.FrameBorder.DEFAULT_COLOR
Should Not Be Equal ${selected border color} ${unselected border color}
Thumbnail Should Not Be Selected ${second image}
Tree Node Should Be Selected project tree ${first tree path}
Tree Node Should Not Be Selected project tree ${second tree path}
Click On Tree Node project tree ${second tree path}
Tree Node Should Be Selected project tree ${first tree path}
Tree Node Should Not Be Selected project tree ${second tree path}
Click On Tree Node project tree ${second tree path}
Thumbnail Should Not Be Selected ${first image}
Thumbnail Border Color Should Be ${second image} ${selected border color}
Tree Node Should Not Be Selected project tree ${first tree path}
Tree Node Should Be Selected project tree ${second tree path}
Thumbnail Border Color Should Be ${second image} ${selected border color}
Tree Node Should Not Be Selected project tree ${first tree path}
Tree Node Should Be Selected project tree ${second tree path}
Click Thumbnail ${first image}
Thumbnail Border Color Should Be ${first image} ${selected border color}
Thumbnail Border Color Should Be ${first image} ${selected border color}
Thumbnail Should Not Be Selected ${second image}
Tree Node Should Be Selected project tree ${first tree path}
Tree Node Should Not Be Selected project tree ${second tree path}
Tree Node Should Be Selected project tree ${first tree path}
Tree Node Should Not Be Selected project tree ${second tree path}
Click Thumbnail ${second image}
Thumbnail Should Not Be Selected ${first image}
Thumbnail Border Color Should Be ${second image} ${selected border color}
Tree Node Should Not Be Selected project tree ${first tree path}
Tree Node Should Be Selected project tree ${second tree path}
Thumbnail Border Color Should Be ${second image} ${selected border color}
Tree Node Should Not Be Selected project tree ${first tree path}
Tree Node Should Be Selected project tree ${second tree path}

0 comments on commit c0c0778

Please sign in to comment.