# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: D:\ws\main # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/ResultBar.java --- gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/ResultBar.java +++ gsf.testrunner/src/org/netbeans/modules/gsf/testrunner/ResultBar.java @@ -84,8 +84,6 @@ private static final Color COVERED_DARK = new Color(30, 180, 30); private static final Color NO_TESTS_LIGHT = new Color(200, 200, 200); private static final Color NO_TESTS_DARK = new Color(110, 110, 110); - private static final Color ABORTED_TESTS_LIGHT = new Color(246, 232, 206); - private static final Color ABORTED_TESTS_DARK = new Color(214, 157, 41); private boolean emphasize; private boolean selected; /** Passed tests percentage: 0.0f <= x <= 100f */ @@ -226,23 +224,16 @@ amountFail = 0; } - Graphics2D g2 = (Graphics2D) g; - - g2.setColor(getBackground()); - Color notCoveredLight = NOT_COVERED_LIGHT; Color notCoveredDark = NOT_COVERED_DARK; Color coveredLight = COVERED_LIGHT; Color coveredDark = COVERED_DARK; Color noTestsLight = NO_TESTS_LIGHT; Color noTestsDark = NO_TESTS_DARK; - Color abortedTestsLight = ABORTED_TESTS_LIGHT; - Color abortedTestsDark = ABORTED_TESTS_DARK; if (emphasize) { coveredDark = coveredDark.darker(); notCoveredDark = notCoveredDark.darker(); noTestsDark = noTestsDark.darker(); - abortedTestsDark = abortedTestsDark.darker(); } else if (selected) { coveredLight = coveredLight.brighter(); coveredDark = coveredDark.darker(); @@ -250,91 +241,35 @@ notCoveredDark = notCoveredDark.darker(); noTestsLight = noTestsLight.brighter(); noTestsDark = noTestsDark.darker(); - abortedTestsLight = abortedTestsLight.brighter(); - abortedTestsDark = abortedTestsDark.darker(); } + Graphics2D g2 = (Graphics2D) g; + Color light; + Color dark; - if (passedReported){ - if(amountFail > 0) { - g2.setPaint(new GradientPaint(0, phase, notCoveredLight, 0, phase + height/2, notCoveredDark, true)); - g2.fillRect(amountFull, 1, skippedReported ? amountFail : width - 1, height); - g2.setColor(getForeground()); + if (abortedReported || skippedReported || passedReported) { + //running with at least one result or finished + if ((amountAbort > 0 || amountFail > 0)) { + //any failure -> red + light = notCoveredLight; + dark = notCoveredDark; + } else { + //only successful tests -> green + if (amountFull - amountSkip > 0) { + light = coveredLight; + dark = coveredDark; + } else { + //contains ignored tests -> gray + light = noTestsLight; + dark = noTestsDark; } - - g2.setPaint(new GradientPaint(0, phase, coveredLight, 0, phase + height/2, coveredDark, true)); - g2.fillRect(1, 1, amountFull, height); - - if(skippedReported) { - g2.setColor(getForeground()); - g2.setPaint(new GradientPaint(0, phase, noTestsLight, 0, phase + height/2, noTestsDark, true)); - g2.fillRect(amountFull + amountFail, 1, width - 1, height); } - - if(abortedReported) { - g2.setColor(getForeground()); - g2.setPaint(new GradientPaint(0, phase, abortedTestsLight, 0, phase + height/2, abortedTestsDark, true)); - g2.fillRect(amountFull + amountFail + amountSkip, 1, width - 1, height); - } - - Rectangle oldClip = g2.getClipBounds(); - if (passedPercentage > 0.0f) { - g2.setColor(coveredDark); - g2.clipRect(0, 0, amountFull + 1, height); - g2.drawRect(0, 0, width - 1, height - 1); - } - if (passedPercentage < 100.0f) { - if (amountFail > 0) { - g2.setColor(notCoveredDark); - g2.setClip(oldClip); - g2.clipRect(amountFull + 1, 0, width - amountSkip - amountAbort, height); - g2.drawRect(0, 0, width - 1, height - 1); - } - if(skippedReported) { - g2.setColor(noTestsDark); - g2.setClip(oldClip); - g2.clipRect(amountFull + amountFail, 0, width, height); - g2.drawRect(0, 0, width - 1, height - 1); - } - if(abortedReported) { - g2.setColor(abortedTestsDark); - g2.setClip(oldClip); - g2.clipRect(amountFull + amountFail + amountSkip, 0, width, height); - g2.drawRect(0, 0, width - 1, height - 1); - } - } - g2.setClip(oldClip); - } else if (skippedReported){ - if (amountFail > 0) { - g2.setPaint(new GradientPaint(0, phase, notCoveredLight, 0, phase + height / 2, notCoveredDark, true)); - g2.fillRect(1, 1, amountFail, height); - g2.setColor(getForeground()); - } - g2.setPaint(new GradientPaint(0, phase, noTestsLight, 0, phase + height / 2, noTestsDark, true)); - g2.fillRect(amountFail, 1, width - 1, height); - - Rectangle oldClip = g2.getClipBounds(); - if (skippedPercentage > 0.0f) { - g2.setColor(noTestsDark); - g2.clipRect(0, 0, amountFull + 1, height); - g2.drawRect(0, 0, width - 1, height - 1); - } - if (skippedPercentage < 100.0f) { - g2.setColor(noTestsDark); - g2.setClip(oldClip); - g2.clipRect(amountFull, 0, width, height); - g2.drawRect(0, 0, width - 1, height - 1); - } - g2.setClip(oldClip); } else { - g2.setPaint(new GradientPaint(0, phase, noTestsLight, 0, phase + height/2, noTestsDark, true)); - g2.fillRect(0, 1, width - 1, height); - Rectangle oldClip = g2.getClipBounds(); - g2.setColor(noTestsDark); - g2.setClip(oldClip); - g2.clipRect(0, 0, width, height); - g2.drawRect(0, 0, width - 1, height - 1); - g2.setClip(oldClip); + //running -> gray + light = noTestsLight; + dark = noTestsDark; } + g2.setPaint(new GradientPaint(0, phase, light, 0, phase + height / 2, dark, true)); + g2.fillRect(1, 1, barRectWidth, height); g2.setFont(getFont()); paintDropShadowText(g2, barRectWidth, barRectHeight);