public void setUp() throws IOException
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
+ Cache.initLogger();
+
String inMenuString = ("EMBL-EBI Search | http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$"
+ SEQUENCE_ID
+ "$"
DataSourceType.PASTE, FileFormat.Fasta);
AlignFrame af = new AlignFrame(alignment, 700, 500);
parentPanel = new AlignmentPanel(af, af.getViewport());
- testee = new PopupMenu(parentPanel, null, null);
+ testee = new PopupMenu(parentPanel, alignment.getSequenceAt(0), null);
int i = 0;
for (SequenceI seq : alignment.getSequences())
{
testee.configureReferenceAnnotationsMenu(menu, seqs);
assertTrue(menu.isEnabled());
String s = MessageManager.getString("label.add_annotations_for");
- String expected = "<html><style> p.ttip {width: 350; text-align: justify; word-wrap: break-word;}</style><p class=\"ttip\">"
- + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
+ // String expected = "<html><style> p.ttip {width: 350; text-align: justify;
+ // word-wrap: break-word;}</style><p class=\"ttip\">"
+ // + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
+ String expected = "<html><style> div.ttip {width:350px;white-space:pre-wrap;padding:2px;overflow-wrap:break-word;}</style>"
+ + "<div class=\"ttip\">" + s
+ + "<br/>Jmol/secondary structure<br/>PDB/Temp </div></html>";
assertEquals(expected, menu.getToolTipText());
}
testee.configureReferenceAnnotationsMenu(menu, seqs);
assertTrue(menu.isEnabled());
String s = MessageManager.getString("label.add_annotations_for");
- String expected = "<html><style> p.ttip {width: 350; text-align: justify; word-wrap: break-word;}</style><p class=\"ttip\">"
- + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
+ // String expected = "<html><style> p.ttip {width: 350; text-align: justify;
+ // word-wrap: break-word;}</style><p class=\"ttip\">"
+ // + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
+ String expected = "<html><style> div.ttip {width:350px;white-space:pre-wrap;padding:2px;overflow-wrap:break-word;}</style>"
+ + "<div class=\"ttip\">Add annotations for<br/>Jmol/secondary structure<br/>PDB/Temp </div></html>";
assertEquals(expected, menu.getToolTipText());
}
* note dbref GENE3D is matched to link Gene3D, the latter is displayed
*/
linkMenu = PopupMenu.buildLinkMenu(seq1, noFeatures);
- assertEquals(linkText, linkMenu.getText());
linkItems = linkMenu.getMenuComponents();
assertEquals(3, linkItems.length);
assertEquals("EMBL-EBI Search", ((JMenuItem) linkItems[0]).getText());
Preferences.sequenceUrlLinks = factory.createUrlProvider();
linkMenu = PopupMenu.buildLinkMenu(seq1, noFeatures);
- assertEquals(linkText, linkMenu.getText());
linkItems = linkMenu.getMenuComponents();
assertEquals(1, linkItems.length);
assertEquals("EMBL-EBI Search", ((JMenuItem) linkItems[0]).getText());
+
+ /*
+ * if sequence is null, only feature links are shown (alignment popup submenu)
+ */
+ linkMenu = PopupMenu.buildLinkMenu(null, noFeatures);
+ linkItems = linkMenu.getMenuComponents();
+ assertEquals(0, linkItems.length);
+
+ List<SequenceFeature> features = new ArrayList<>();
+ SequenceFeature sf = new SequenceFeature("type", "desc", 1, 20, null);
+ features.add(sf);
+ linkMenu = PopupMenu.buildLinkMenu(null, features);
+ linkItems = linkMenu.getMenuComponents();
+ assertEquals(0, linkItems.length); // feature has no links
+
+ sf.addLink("Pfam family|http://pfam.xfam.org/family/PF00111");
+ linkMenu = PopupMenu.buildLinkMenu(null, features);
+ linkItems = linkMenu.getMenuComponents();
+ assertEquals(1, linkItems.length);
+ JMenuItem item = (JMenuItem) linkItems[0];
+ assertEquals("Pfam family", item.getText());
+ // ? no way to verify URL, compiled into link's actionListener
}
@Test(groups = { "Functional" })