}
/**
- * For TestNG
- *
- * @author Bob Hanson 2019.08.28
+ * Updates the cached values to include the last user input as the most
+ * recently added (without duplication), and rebuilds the dropdown list with
+ * this as the first entry. If the maximum configured cache size would be
+ * exceeded, the oldest entry is removed.
*/
- public void updateCacheNow()
+ void updateCacheNow()
{
- int cacheLimit = Integer.parseInt(appCache.getCacheLimit(cacheKey));
+ int cacheLimit = Integer.valueOf(appCache.getCacheLimit(cacheKey));
String userInput = getUserInput();
if (userInput != null && !userInput.isEmpty())
{
{
try
{
- System.err.println("ASeqFetch " + className);
return (DbSourceProxy) Class.forName(className).newInstance();
} catch (Exception e)
{
* Test for JAL-1306 - conservation thread should run even when only Quality
* (and not Conservation) is enabled in Preferences
*/
- @Test(groups = { "Functional" }, timeOut = 2000) // BH removed timeOut=2000
+ @Test(groups = { "Functional" }, timeOut = 2000)
public void testUpdateConservation_qualityOnly()
{
Cache.setPropertyNoSave("SHOW_ANNOTATIONS",
AlignViewport viewport = af.getViewport();
synchronized (this)
{
- System.out.println("AVT consv: "
- + viewport.getAlignmentConservationAnnotation());
+ // System.out.println("AVT consv: "
+ // + viewport.getAlignmentConservationAnnotation());
try
{
wait(250); // BH increased from 50 -- was getting Quality in column 1
} catch (InterruptedException e)
{
}
- System.out.println("AVT consv: "
- + viewport.getAlignmentConservationAnnotation());
+ // System.out.println("AVT consv: "
+ // + viewport.getAlignmentConservationAnnotation());
while (viewport.getAlignmentConservationAnnotation() != null)
{
try
// af.paintImmediately(af.getBounds());
AlignViewport testme = af.getViewport();
SequenceI cons = testme.getConsensusSeq();
- System.out.println("AVT " + cons.getSequenceAsString());
+ // System.out.println("AVT " + cons.getSequenceAsString());
assertEquals("A-C", cons.getSequenceAsString());
}
* or without hidden columns
*/
@Test(groups = "Functional")
- public void TestSetScrollValues()
+ public void testSetScrollValues()
{
ViewportRanges ranges = af.getViewport().getRanges();
af.alignPanel.setScrollValues(0, 0);
* 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());
+ // 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());
+ // System.out.println("APT range end1 " + ranges.getEndRes());
// endRes has changed
assertNotEquals(ranges.getEndRes(), endres);
waitSome();
af.paintImmediately(af.getBounds());
- System.out.println("APT range end3 " + ranges.getEndRes());
+ // System.out.println("APT range end3 " + ranges.getEndRes());
// endRes back to original value
assertEquals(ranges.getEndRes(), endres);
* Test the method that computes wrapped width in residues, height of wrapped
* widths in pixels, and the number of widths visible
*/
- @Test(groups = "BHTEST")
+ @Test(groups = "Functional")
public void testCalculateWrappedGeometry_noAnnotations()
{
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
* Test the method that computes wrapped width in residues, height of wrapped
* widths in pixels, and the number of widths visible
*/
- @Test(groups = "BHTEST")
+ @Test(groups = "Functional")
public void testCalculateWrappedGeometry_withAnnotations()
{
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
* endSeq should be unchanged, but the vertical repeat height should include
* all sequences.
*/
- @Test(groups = "BHTEST")
+ @Test(groups = "Functional")
public void testCalculateWrappedGeometry_fromScrolled()
{
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
assertEquals(al.getWidth(), 157);
assertEquals(al.getHeight(), 15);
av.getRanges().setStartEndSeq(0, 3);
- System.out.println("SCT1 " + av.getRanges().getEndSeq());
av.setShowAnnotation(false);
av.setScaleAboveWrapped(true);
- System.out.println("SCT2 " + av.getRanges().getEndSeq());
-
SeqCanvas testee = af.alignPanel.getSeqPanel().seqCanvas;
-
- System.out.println("SCT3 " + av.getRanges().getEndSeq());
-
av.setWrapAlignment(true);
-
- System.out.println("SCT4 " + av.getRanges().getEndSeq());
-
av.setFont(new Font("SansSerif", Font.PLAIN, 14), true);
-
- System.out.println("SCT5 " + av.getRanges().getEndSeq());
-
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
// Windows h=19, w=11.
int canvasHeight = 300;
testee.calculateWrappedGeometry(canvasWidth, canvasHeight);
- System.out.println("SCT6 " + av.getRanges().getEndSeq());
-
assertEquals(av.getRanges().getEndSeq(), 3); // unchanged
int repeatingHeight = (int) PA.getValue(testee,
"wrappedRepeatHeightPx");
final int charWidth = alignFrame.getViewport().getCharWidth();
assertTrue(charWidth > 0); // sanity check
assertEquals(alignFrame.getViewport().getRanges().getStartRes(), 0);
-
- System.out.println("SPT endres "
- + alignFrame.getViewport().getRanges().getEndRes());
/*
* mouse at top left of unwrapped panel
*/
SeqCanvas seqCanvas = alignFrame.alignPanel.getSeqPanel().seqCanvas;
int w = seqCanvas.getWidth();
// limited to number of whole columns, base 0
- // BH there are only 61 residues, but this calculation gives 65
- // from SeqPanel return for findColumn:
-
- // /*
- // * make sure we calculate relative to visible alignment,
- // * rather than right-hand gutter
- // */
- // x = Math.min(x, seqCanvas.getX() + seqCanvas.getWidth());
- // res = (x / charWidth) + startRes;
- // res = Math.min(res, av.getRanges().getEndRes());
int expected = w / charWidth;
expected = Math.min(
String testInput = "TestInput";
cacheBox.addItem(testInput);
cacheBox.setSelectedItem(testInput);
- cacheBox.updateCacheNow();
-
- // try
- // {
- // // This delay is essential to prevent the
- // // assertion below from executing before
- // // swing thread finishes updating the combo-box
- // Thread.sleep(100);
- // } catch (InterruptedException e)
- // {
- // e.printStackTrace();
- // }
+ cacheBox.updateCacheNow(); // synchronous update
userInput = cacheBox.getUserInput();
Assert.assertEquals(testInput, userInput);
}
cacheBox.addItem(testInput);
cacheBox.setSelectedItem(testInput);
cacheBox.updateCacheNow();
- // synchronized (this)
- // {
- // try
- // {
- // wait(100);
- // // This delay is to let
- // // cacheBox.updateCache() finish updating the cache
- // Thread.sleep(200);
- // } catch (InterruptedException e)
- // {
- // e.printStackTrace();
- // }
- // }
LinkedHashSet<String> foundCache = appCache
.getAllCachedItemsFor(TEST_CACHE_KEY);
Assert.assertTrue(foundCache.contains(testInput));
@BeforeMethod(alwaysRun = true)
public void setUpBeforeTest()
{
- //required for Windows, only when in batch mode?
- setUp();
+ /*
+ * fudge for failure in test suite on Windows;
+ * without this call added, av.getAlignment() is null;
+ * root cause not known - AlignViewport.dispose() called??
+ */
+ setUp();
+
List<SequenceFeature> sfs = seq.getSequenceFeatures();
for (SequenceFeature sf : sfs)
{