Mercurial > hg > release > thermostat-1.6
changeset 1911:49cb9ec05763
Fix ThermostatChartPanel tests
Does not use Duration class for comparison since there is no equals or hashcode.
Fixes ThermostatChartPanel.setTimeRangeToShow to use duration parameter instead of initialDuration.
PR3015
Reviewed-by: jerboaa
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-June/019395.html
author | Jie Kang <jkang@redhat.com> |
---|---|
date | Mon, 13 Jun 2016 12:20:49 -0400 |
parents | 67f0eb234d5d |
children | 45ec372ef040 |
files | client/swing/src/main/java/com/redhat/thermostat/client/swing/components/experimental/ThermostatChartPanel.java client/swing/src/test/java/com/redhat/thermostat/client/swing/components/experimental/ThermostatChartPanelTest.java |
diffstat | 2 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/components/experimental/ThermostatChartPanel.java Thu Jun 09 11:17:11 2016 -0400 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/components/experimental/ThermostatChartPanel.java Mon Jun 13 12:20:49 2016 -0400 @@ -159,7 +159,7 @@ // Don't drop old data; just dont' show it. plot.getDomainAxis().setAutoRange(true); - plot.getDomainAxis().setFixedAutoRange(initialDuration.unit.toMillis(initialDuration.value)); + plot.getDomainAxis().setFixedAutoRange(duration.unit.toMillis(duration.value)); } }
--- a/client/swing/src/test/java/com/redhat/thermostat/client/swing/components/experimental/ThermostatChartPanelTest.java Thu Jun 09 11:17:11 2016 -0400 +++ b/client/swing/src/test/java/com/redhat/thermostat/client/swing/components/experimental/ThermostatChartPanelTest.java Mon Jun 13 12:20:49 2016 -0400 @@ -122,8 +122,7 @@ @Override public void propertyChange(final PropertyChangeEvent evt) { Duration d = (Duration) evt.getNewValue(); - Duration expected = new Duration(5, TimeUnit.MINUTES); - if (d.equals(expected)) { + if (d.unit.equals(TimeUnit.MINUTES) && d.value == 5) { b[0] = true; } } @@ -145,8 +144,7 @@ @Override public void propertyChange(final PropertyChangeEvent evt) { Duration d = (Duration) evt.getNewValue(); - Duration expected = new Duration(10, TimeUnit.HOURS); - if (d.equals(expected)) { + if (d.unit.equals(TimeUnit.HOURS) && d.value == 10) { b[0] = true; } }