Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java6
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java28
2 files changed, 24 insertions, 10 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index 1d4926a0ba..9553562596 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -992,9 +992,9 @@ public void setDisabledImage (Image image) {
} else {
imageList.put (imageIndex, image);
}
- }
- if (!enabled) {
- setImage(image);
+ if (!enabled) {
+ setImage(image);
+ }
}
}
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java
index f8dbccbec9..2455082cc1 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java
@@ -69,23 +69,37 @@ public void test_setDisabledImage() {
toolItem.setImage(images[0]);
toolItem.setDisabledImage(images[1]);
toolItem.setEnabled(false);
- assertEquals(images[1], item.getImage());
+ assertEquals(images[1], toolItem.getImage());
+
toolItem.setEnabled(true);
- assertEquals(images[0], item.getImage());
+ assertEquals(images[0], toolItem.getImage());
+
toolItem.setDisabledImage(images[0]);
- assertEquals(images[0], item.getImage());
+ assertEquals(images[0], toolItem.getImage());
+
toolItem.setEnabled(false);
- assertEquals(images[0], item.getImage());
+ assertEquals(images[0], toolItem.getImage());
+
toolItem.setImage(images[0]);
toolItem.setEnabled(true);
- assertEquals(images[0], item.getImage());
+ assertEquals(images[0], toolItem.getImage());
+
toolItem.setDisabledImage(images[2]);
toolItem.setEnabled(false);
- assertEquals(images[2], item.getImage());
+ assertEquals(images[2], toolItem.getImage());
+
+ toolItem.setEnabled(true);
+ toolItem.setDisabledImage(null);
+ toolItem.setEnabled(false);
+ assertEquals(images[0], toolItem.getImage());
+
toolItem.setEnabled(true);
toolItem.setDisabledImage(null);
+ assertEquals(images[0], toolItem.getImage());
+
toolItem.setEnabled(false);
- assertEquals(images[0], item.getImage());
+ toolItem.setDisabledImage(null);
+ assertEquals(images[0], toolItem.getImage());
}
}

Back to the top