diff -r 4ad59aaee882 -r 2f468c1958d0 javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/gauge/GaugeTest.java --- a/javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/gauge/GaugeTest.java Fri Sep 17 08:28:21 2010 +0300 +++ b/javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/gauge/GaugeTest.java Mon Oct 04 00:10:53 2010 +0300 @@ -89,12 +89,14 @@ { java.util.Vector methodNames = new java.util.Vector(); methodNames.addElement("testAccessors"); + methodNames.addElement("gaugeCurrentValuesTest"); return methodNames; } protected void runTest() throws Throwable { if(getName().equals("testAccessors")) testAccessors(); + else if(getName().equals("gaugeCurrentValuesTest")) gaugeCurrentValuesTest(); else super.runTest(); } /** @@ -204,4 +206,40 @@ //print("labeled interactive minimum width: " // + gauge4.getMinimumWidth()); } + + /** + * Tests Non-interactive INDEFINITE Gauge with different current values. + *

+ * Test passes if current values of the Gauge will not be changed. + *

+ * Test fails if current values of the Gauge will be changed. + *

+ */ + public void gaugeCurrentValuesTest() + { + Gauge gaugeObj; + int[] values = {Gauge.CONTINUOUS_IDLE, Gauge.CONTINUOUS_RUNNING, + Gauge.INCREMENTAL_IDLE, Gauge.INCREMENTAL_UPDATING}; + + for (int i=0; i != values.length; ++i) + { + gaugeObj = new Gauge("MT Gauge", false, Gauge.INDEFINITE, values[i]); + + gaugeObj.setMaxValue(Gauge.INDEFINITE); + + if (gaugeObj.getMaxValue() != Gauge.INDEFINITE) + { + String s = "Test FAILED\n Passed: Gauge.INDEFINITE ("+ + Gauge.INDEFINITE+"), got:" + gaugeObj.getMaxValue(); + fail("1. "+s); + } + + if (gaugeObj.getValue() != values[i]) + { + String s = "Test FAILED\n Current value was changed. Was: " + + values[i] + ", became: "+gaugeObj.getValue(); + fail("2. "+s); + } + } + } }