Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravan Kumar Lakkimsetti2015-03-13 11:58:16 +0000
committerSravan Kumar Lakkimsetti2015-03-13 11:58:16 +0000
commit661059ee70e56500382288a6b372d43b6bc7b541 (patch)
tree81a36a5612d22af84f135662a2cc9460694b4002
parentfcbecdd5b8546b8c21fd9d91bdcd3af08845f6a8 (diff)
parentdccc4bfeee49ccc587a9e8602bb99f7ac6cabeda (diff)
downloadeclipse.platform.swt-661059ee70e56500382288a6b372d43b6bc7b541.tar.gz
eclipse.platform.swt-661059ee70e56500382288a6b372d43b6bc7b541.tar.xz
eclipse.platform.swt-661059ee70e56500382288a6b372d43b6bc7b541.zip
Merge branch 'slakkimsetti/hiDpiBranch2' of ssh://slakkimsetti@git.eclipse.org/gitroot/platform/eclipse.platform.swt.git into slakkimsetti/hiDpiBranch2
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java88
-rw-r--r--tests/org.eclipse.swt.tests/data/collapseall.pngbin0 -> 360 bytes
-rw-r--r--tests/org.eclipse.swt.tests/data/collapseall@1.5x.pngbin0 -> 551 bytes
-rw-r--r--tests/org.eclipse.swt.tests/data/collapseall@2x.pngbin0 -> 483 bytes
4 files changed, 86 insertions, 2 deletions
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
index 3259d37c64..e8d3c8dd86 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java
@@ -19,20 +19,22 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import junit.framework.TestCase;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.ImageDataProvider;
+import org.eclipse.swt.graphics.ImageFileNameProvider;
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.internal.Compatibility;
import org.eclipse.swt.widgets.Display;
+import junit.framework.TestCase;
+
/**
* Automated Test Suite for class org.eclipse.swt.graphics.Image
*
@@ -422,6 +424,88 @@ public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String()
}
}
+public void test_ConstructorLorg_eclipse_swt_graphics_Device_ImageFileNameProvider() {
+ // Null provider
+ ImageFileNameProvider provider = null;
+ try {
+ Image image = new Image(display, provider);
+ image.dispose();
+ fail("No exception thrown for file name == null");
+ } catch (IllegalArgumentException e) {
+ assertSWTProblem("Incorrect exception thrown for provider == null", SWT.ERROR_NULL_ARGUMENT, e);
+ }
+ // Invalid provider
+ provider = new ImageFileNameProvider() {
+ public String getImagePath(int zoom) {
+ return null;
+ }
+ };
+ try {
+ Image image = new Image(display, provider);
+ image.dispose();
+ fail("No exception thrown for non-existent file name");
+ } catch (IllegalArgumentException e) {
+ assertSWTProblem("Incorrect exception thrown for provider == null", SWT.ERROR_INVALID_ARGUMENT, e);
+ }
+ // Valid provider
+ provider = new ImageFileNameProvider() {
+ public String getImagePath(int zoom) {
+ switch (zoom) {
+ case 100:
+ return "./data/collapseall.png";
+ case 150:
+ return "./data/collapseall@1.5x.png";
+ case 200:
+ return "./data/collapseall@2x.png";
+ }
+ return null;
+ }
+ };
+ Image image = new Image(display, provider);
+ image.dispose();
+}
+
+public void test_ConstructorLorg_eclipse_swt_graphics_Device_ImageDataProvider() {
+ // Null provider
+ ImageDataProvider provider = null;
+ try {
+ Image image = new Image(display, provider);
+ image.dispose();
+ fail("No exception thrown for file name == null");
+ } catch (IllegalArgumentException e) {
+ assertSWTProblem("Incorrect exception thrown for provider == null", SWT.ERROR_NULL_ARGUMENT, e);
+ }
+ // Invalid provider
+ provider = new ImageDataProvider() {
+ public ImageData getImageData(int zoom) {
+ return null;
+ }
+ };
+ try {
+ Image image = new Image(display, provider);
+ image.dispose();
+ fail("No exception thrown for non-existent file name");
+ } catch (IllegalArgumentException e) {
+ assertSWTProblem("Incorrect exception thrown for provider == null", SWT.ERROR_INVALID_ARGUMENT, e);
+ }
+ // Valid provider
+ provider = new ImageDataProvider() {
+ public ImageData getImageData(int zoom) {
+ switch (zoom) {
+ case 100:
+ return new ImageData ("./data/collapseall.png");
+ case 150:
+ return new ImageData ("./data/collapseall@1.5x.png");
+ case 200:
+ return new ImageData ("./data/collapseall@2x.png");
+ }
+ return null;
+ }
+ };
+ Image image = new Image(display, provider);
+ image.dispose();
+}
+
public void test_equalsLjava_lang_Object() {
Image image = null;
Image image1 = null;
diff --git a/tests/org.eclipse.swt.tests/data/collapseall.png b/tests/org.eclipse.swt.tests/data/collapseall.png
new file mode 100644
index 0000000000..0ac25a9247
--- /dev/null
+++ b/tests/org.eclipse.swt.tests/data/collapseall.png
Binary files differ
diff --git a/tests/org.eclipse.swt.tests/data/collapseall@1.5x.png b/tests/org.eclipse.swt.tests/data/collapseall@1.5x.png
new file mode 100644
index 0000000000..24dd56386e
--- /dev/null
+++ b/tests/org.eclipse.swt.tests/data/collapseall@1.5x.png
Binary files differ
diff --git a/tests/org.eclipse.swt.tests/data/collapseall@2x.png b/tests/org.eclipse.swt.tests/data/collapseall@2x.png
new file mode 100644
index 0000000000..9fecefbb75
--- /dev/null
+++ b/tests/org.eclipse.swt.tests/data/collapseall@2x.png
Binary files differ

Back to the top