endRes = end;
}
- changeSupport.firePropertyChange("startres", oldstartres, start);
- if (oldstartres == start)
+ changeSupport.firePropertyChange("startres", oldstartres, startRes);
+ if (oldstartres == startRes)
{
// event won't be fired if start positions are same
// fire an event for the end positions in case they changed
- changeSupport.firePropertyChange("endres", oldendres, end);
+ changeSupport.firePropertyChange("endres", oldendres, endRes);
}
}
endSeq = end;
}
- changeSupport.firePropertyChange("startseq", oldstartseq, start);
- if (oldstartseq == start)
+ changeSupport.firePropertyChange("startseq", oldstartseq, startSeq);
+ if (oldstartseq == startSeq)
{
// event won't be fired if start positions are the same
// fire in case the end positions changed
- changeSupport.firePropertyChange("endseq", oldendseq, end);
+ changeSupport.firePropertyChange("endseq", oldendseq, endSeq);
}
}
assertTrue(l.verify(0, emptylist));
l.reset();
+ // check new value fired by event is corrected startres
+ vr.setStartEndRes(-1, 5);
+ assertTrue(l.verify(1, Arrays.asList("startres"), Arrays.asList(0)));
+ l.reset();
+
+ // check new value fired by event is corrected endres
+ vr.setStartEndRes(0, -1);
+ assertTrue(l.verify(1, Arrays.asList("endres"), Arrays.asList(0)));
+ l.reset();
+
vr.setStartEndSeq(2, 15);
assertTrue(l.verify(1, Arrays.asList("startseq")));
l.reset();
assertTrue(l.verify(0, emptylist));
l.reset();
+ vr.setStartEndRes(2, 2); // so seq and res values should be different, in
+ // case of transposing in code
+ l.reset();
+
+ // check new value fired by event is corrected startseq
+ vr.setStartEndSeq(-1, 5);
+ assertTrue(l.verify(1, Arrays.asList("startseq"), Arrays.asList(0)));
+ l.reset();
+
+ // check new value fired by event is corrected endseq
+ vr.setStartEndSeq(0, -1);
+ assertTrue(l.verify(1, Arrays.asList("endseq"), Arrays.asList(0)));
+ l.reset();
+
+ // reset for later tests
+ vr.setStartEndSeq(2, 15);
+ l.reset();
+
// test viewport height and width setting triggers event
vr.setViewportHeight(10);
assertTrue(l.verify(1, Arrays.asList("endseq")));
private List<String> events = new ArrayList<String>();
+ private List<Integer> newvalues = new ArrayList<Integer>();
+
public MockPropChangeListener(ViewportRanges vr)
{
vr.addPropertyChangeListener(this);
{
firecount++;
events.add(evt.getPropertyName());
+ newvalues.add((Integer) evt.getNewValue());
+ }
+
+ public boolean verify(int count, List<String> eventslist,
+ List<Integer> valueslist)
+ {
+ return (count == firecount) && events.equals(eventslist)
+ && newvalues.equals(valueslist);
}
public boolean verify(int count, List<String> eventslist)
{
firecount = 0;
events.clear();
+ newvalues.clear();
}
}