import java.lang.reflect.InvocationTargetException;
-import javax.swing.SwingUtilities;
-
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa",
DataSourceType.FILE);
- /*
- * ensure the panel has been repainted and so ViewportRanges set
- */
- SwingUtilities.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- af.repaint();
- }});
+ af.paintImmediately(af.getBounds());
/*
* wait for Consensus thread to complete
{
try
{
- wait(50);
+ wait(250); // BH was 50
} catch (InterruptedException e)
{
}
* or without hidden columns
*/
@Test(groups = "Functional")
- public void TestSetScrollValues()
+ public void testSetScrollValues()
{
ViewportRanges ranges = af.getViewport().getRanges();
af.alignPanel.setScrollValues(0, 0);
scrollpos = 130;
af.getViewport().showAllHiddenColumns();
af.alignPanel.setScrollValues(scrollpos, 5);
+ af.paintImmediately(af.getBounds());
assertEquals(ranges.getEndRes(), af.getViewport()
.getAlignment().getWidth() - 1);
// endRes should be set to width of alignment - 1 - the number of hidden
// columns
af.getViewport().hideColumns(30, 50);
+ af.paintImmediately(af.getBounds());
af.alignPanel.setScrollValues(scrollpos, 5);
assertEquals(ranges.getEndRes(), af.getViewport()
.getAlignment().getWidth() - 1 - 21); // 21 is the number of hidden
* when switching from wrapped back to unwrapped mode (JAL-2739)
*/
@Test(groups = "Functional")
- public void TestUpdateLayout_endRes()
+ public void testUpdateLayout_endRes()
{
// get details of original alignment dimensions
ViewportRanges ranges = af.getViewport().getRanges();
int endres = ranges.getEndRes();
+ // System.out.println("APT range end0 " + ranges.getEndRes());
// wrap
af.alignPanel.getAlignViewport().setWrapAlignment(true);
af.alignPanel.updateLayout();
-
+ af.paintImmediately(af.getBounds());
+ waitSome();
+ // System.out.println("APT range end1 " + ranges.getEndRes());
// endRes has changed
assertNotEquals(ranges.getEndRes(), endres);
// unwrap
af.alignPanel.getAlignViewport().setWrapAlignment(false);
af.alignPanel.updateLayout();
+ waitSome();
+ af.paintImmediately(af.getBounds());
+
+ // System.out.println("APT range end3 " + ranges.getEndRes());
// endRes back to original value
assertEquals(ranges.getEndRes(), endres);
}
+
+ private void waitSome()
+ {
+
+ // just a hack
+ synchronized (this)
+ {
+ try
+ {
+ wait(250);
+ } catch (InterruptedException e)
+ {
+ }
+ }
+ }
}