View | Details | Raw Unified | Return to bug 254458 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ercp/swt/expanded/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java (-39 / +65 lines)
Lines 20-25 Link Here
20
import org.eclipse.ercp.swt.core.tests.junit.SwtTestCase;
20
import org.eclipse.ercp.swt.core.tests.junit.SwtTestCase;
21
import org.eclipse.swt.*;
21
import org.eclipse.swt.*;
22
import org.eclipse.swt.graphics.*;
22
import org.eclipse.swt.graphics.*;
23
import org.eclipse.swt.internal.Platform;
23
24
24
/**
25
/**
25
 * Automated Test Suite for class org.eclipse.swt.graphics.ImageLoader
26
 * Automated Test Suite for class org.eclipse.swt.graphics.ImageLoader
Lines 70-80 Link Here
70
		String fileName = SwtTestCase.imageFilenames[0];
71
		String fileName = SwtTestCase.imageFilenames[0];
71
		for (int i=0; i<numFormats; i++) {
72
		for (int i=0; i<numFormats; i++) {
72
			String format = SwtTestCase.imageFormats[i];
73
			String format = SwtTestCase.imageFormats[i];
73
			stream = SwtTestCase.class.getResourceAsStream(fileName + "." + format);
74
			//Win32 does not support ImageLoader load jpg/png as inputstream
74
			loader.load(stream);
75
            boolean isPlatformWin32 = Platform.isWin32();
75
			try {
76
            if (!(isPlatformWin32&&(format=="jpg"|format=="png"))){
76
				stream.close();
77
			  stream = SwtTestCase.class.getResourceAsStream(fileName + "." + format);
77
			} catch (IOException e) {}
78
			  loader.load(stream);
79
			  try {
80
				  stream.close();
81
			  } catch (IOException e) {}
82
		    }
78
		}
83
		}
79
	} finally {
84
	} finally {
80
		try {
85
		try {
Lines 149-165 Link Here
149
			String filename = SwtTestCase.imageFilenames[0];
154
			String filename = SwtTestCase.imageFilenames[0];
150
			// must use jpg since save is not implemented yet in png format		
155
			// must use jpg since save is not implemented yet in png format		
151
			String filetype = "jpg";
156
			String filetype = "jpg";
152
			inStream = SwtTestCase.class.getResourceAsStream(filename + "." + filetype);	
157
			inStream = SwtTestCase.class.getResourceAsStream(filename + "." + filetype);
153
			loader.load(inStream);
158
			//eSWT does not support png and jpg as outputStream saving in Win32, WinCE and WindowMobile.
154
			try {
159
			boolean isPlatformWin32WinCEWM = Platform.isWin32()|Platform.isWinCE()|Platform.isWindowMobile()|Platform.isSmartPhone();
155
				inStream.close();
160
			if (!isPlatformWin32WinCEWM){
156
			} catch (IOException e) {}
161
			  loader.load(inStream);
157
			for (int i = 0; i < imageFormats.length; i++) {
162
			  try {
158
				if (imageFormats[i].equals(filetype)) {
163
			   	inStream.close();
159
					// save using the appropriate format
164
			  } catch (IOException e) {}
160
					loader.save(outStream, SWT.IMAGE_JPEG);
165
			  for (int i = 0; i < imageFormats.length; i++) {
161
					break;
166
				  if (imageFormats[i].equals(filetype)) {
162
				}
167
					  // save using the appropriate format
168
					  loader.save(outStream, SWT.IMAGE_JPEG);
169
					  break;
170
			   	  }
171
			  }
163
			}
172
			}
164
		}
173
		}
165
	} finally {
174
	} finally {
Lines 179-208 Link Here
179
	} catch (IllegalArgumentException e) {
188
	} catch (IllegalArgumentException e) {
180
	}
189
	}
181
	for (int i=0; i<imageFormats.length; i++) {
190
	for (int i=0; i<imageFormats.length; i++) {
182
		for (int j=0; j<SwtTestCase.imageFilenames.length; j++) {
191
        boolean isPlatformWin32 = Platform.isWin32();
183
			filename = SwtTestCase.imageFilenames[j];
192
        boolean isPlatformWinCE5 = Platform.isWinCE();
184
			String filetype = imageFormats[i];
193
//		  Win32 does not support ImageLoader load jpg/png as inputstream
185
			InputStream inStream = SwtTestCase.class.getResourceAsStream(filename + "." + filetype);	
194
      if (!(isPlatformWin32&&(imageFormats[i]=="jpg"|imageFormats[i]=="png"))){
186
			loader.load(inStream);
195
		  for (int j=0; j<SwtTestCase.imageFilenames.length; j++) {	  
187
			try {
196
			  filename = SwtTestCase.imageFilenames[j];
197
			  String filetype = imageFormats[i];
198
			  InputStream inStream = SwtTestCase.class.getResourceAsStream(filename + "." + filetype);
199
			  loader.load(inStream);
200
			  try {
188
				inStream.close();
201
				inStream.close();
189
			} catch (IOException e) {}
202
			  } catch (IOException e) {}
190
			File imageFile = new File(filename + "saved."+filetype);
203
			  File imageFile = new File(filename + "saved."+filetype);
191
			imageFile.delete();
204
			  imageFile.delete();
192
			loader.save(imageFile.getName(), imageTypes[i]);
205
			  //WinCE5 does not support ImageLoader save gif/png
193
			assertTrue("image not saved " + filetype, imageFile.exists());
206
			  if (!(isPlatformWinCE5&&(imageFormats[i]=="gif"|imageFormats[i]=="png"))){
194
		}
207
			     loader.save(imageFile.getName(), imageTypes[i]);
208
			     assertTrue("image not saved " + filetype, imageFile.exists());
209
			  }
210
		  }
211
      }
212
	}
213
	//Win32 does not support ImageLoader load jpg/png as inputstream
214
    boolean isPlatformWin32 = Platform.isWin32();
215
    boolean isPlatformWinCE5 = Platform.isWinCE();
216
	if(!isPlatformWin32){
217
	  filename = "transparent.png";
218
	  InputStream inStream = SwtTestCase.class.getResourceAsStream(filename);
219
	  loader.load(inStream);
220
	  try {
221
		  inStream.close();
222
	  } catch (IOException e) {}
223
	  File imageFile = new File("transparentsaved.png");
224
	  imageFile.delete();
225
	  
226
	  //WinCE5 does not support ImageLoader save gif/png
227
	  if (!isPlatformWinCE5){
228
		  loader.save(imageFile.getName(), SWT.IMAGE_PNG);
229
	      assertTrue("transparent png image not saved ", imageFile.exists());
230
	  }
231
	  // j2se and j2me(cdc) can load from a filename but, j2me(cldc) throws an exception
195
	}
232
	}
196
	filename = "transparent.png";
197
	InputStream inStream = SwtTestCase.class.getResourceAsStream(filename);	
198
	loader.load(inStream);
199
	try {
200
		inStream.close();
201
	} catch (IOException e) {}
202
	File imageFile = new File("transparentsaved.png");
203
	imageFile.delete();
204
	loader.save(imageFile.getName(), SWT.IMAGE_PNG);
205
	assertTrue("transparent png image not saved ", imageFile.exists());
206
	// j2se and j2me(cdc) can load from a filename but, j2me(cldc) throws an exception
207
}
233
}
208
}
234
}
(-).classpath (-4 / +2 lines)
Lines 1-12 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="var" path="JUNIT_HOME/junit.jar"/>
5
	<classpathentry sourcepath="IVEHOME/lib/charconv-src.zip" kind="var" path="IVEHOME/lib/charconv.zip"/>
6
	<classpathentry sourcepath="IVEHOME/lib/jclFoundation10/source/source.zip" kind="var" path="IVEHOME/lib/jclFoundation10/classes.zip"/>
7
	<classpathentry sourcepath="IVEHOME/lib/jclFoundation10/source/locale-src.zip" kind="var" path="IVEHOME/lib/jclFoundation10/locale.zip"/>
8
	<classpathentry kind="src" path="/org.eclipse.ercp.swt.core.tests"/>
4
	<classpathentry kind="src" path="/org.eclipse.ercp.swt.core.tests"/>
9
	<classpathentry kind="src" path="/org.eclipse.ercp.swt.expanded.win"/>
5
	<classpathentry kind="src" path="/org.eclipse.ercp.swt.expanded.win"/>
10
	<classpathentry kind="src" path="/org.eclipse.ercp.swt.core.win"/>
6
	<classpathentry kind="src" path="/org.eclipse.ercp.swt.core.win"/>
7
	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
8
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
11
	<classpathentry kind="output" path="bin"/>
9
	<classpathentry kind="output" path="bin"/>
12
</classpath>
10
</classpath>
(-)folderOpensaved.gif (+1 lines)
Added Link Here
1
GIF89a?????????@@?@??@??ÀÀ??????????????ÀÜÀ¦Êð?¨÷??çïï÷ïç÷ÞççïïÆÖÖç?”ÎÖÖÎÆÖµÎç½ÎÖÆÆÎÖÖ¥½ÎÆ­ÆÞ½ÆÆ­½ÞçÞs¥½Ö­½Æ¥µÆÖÎs­µ?­ÆŒ¥Æï?Îï9­µ?¥µ”¥½cœ÷Öç1¥­?¥½cœï­µ{?µ¥?ï½)ÖÖ)­ï9??œ­?¥µ?ZŒÞÎÆ)???­¥c?)?c{Œ¥Þ¥!µÆ)R„Î?sέ!­­B„ç1?Zœ¥R?k„Þ1{?ï{!?!­½!œÆ)¥¥9k?k??Zk{”ïc!?!„Æ)k??!?Zs{„¥??J?1Z?ïR!?Jcs?)1?Bµ{!?1ck{Z?Zs{Îcksc?{{JZk{??{?{{BZks¥k!ÎRs?B????J?œ{kkJc?kµµZR?JZsckB?µJœk”{”kŒsJZk??cZJJRk{c!B?!?!?!??c?R{s1?”cc?”RŒZcZ9Zc9JRZcc)!?BRZ1?)?ZZ9??cZ)BJZ!??ck)??R„{ZRsRR11??{J9?)k9??cZ9BJ99RBkBJ19s99J)Z9?cJBB1)JB!?!?JR19J11R??19B11J)1RBB!??{!k9BZ11B)1J1c)1B119c)BB))B19))19c!!cZ)R11Rs{B1)1!!!9J!,fH??	X?áÀ!&„ø B?2TèÀ¢G?<tpñã?"3j\?J?¢|?#I?,Li³¤O?mâü?§P?Qe??N£J•ê°ªÕ«	;
(-)targetsaved.gif (+4 lines)
Added Link Here
1
GIF89a???ÀÀÀÀ?ÀÀÀÀÀÀÜÀ¤È?????????@??@@ðÈ????@??@@??? ¤???????????H?A?*\h???B\HÀÀD?'ØÈñb?Cv|?áÈ?ÄxäF?
2
(\±¥?
3
Q?Àr&O?]öTùs¡Î?3?
4
1é½?QJIuêÆ?+n¬Êuj­??Rh?c6ýùqi£>?«Ög?+áÒ,97a]šg?	‘¯]Àr'6??E?Jž|/ ;
(-)foldersaved.gif (+1 lines)
Added Link Here
1
GIF89a?????????@@?@??@??ÀÀ??????????????ÀÜÀ¦Êðàà??????????*U??$*$U$????I*IUI?ªIÕI?m*mUm?ªmÕm??*?U??????*?U??ª¶Õ¶??*?U??ªÛÕÛ?*?U???U*UUU?U?U?U?U$U*$UU$U?U?U?U?UIU*IUUIU?UªIUÕIU?UmU*mUUmU?UªmUÕmU?U’U*’UU’U?U?U?U?U¶U*¶UU¶U?Uª¶UÕ¶U?UÛU*ÛUUÛU?UªÛUÕÛU?U?*?U??U?U?U?U?ªU?ªªªÕ??$?$ªU$?$ªª$ªÕ$?$?I?IªUI?IªªIªÕI?I?m?mªUm?mªªmªÕm?m?’ª*’ªU’ª?ªª’ª??’ª¶ª*¶ªU¶ª?ªª¶ªÕ¶?¶ªÛª*ÛªUÛª?ªªÛªÕÛ?Ûª?*?U??ªª????*????$?$?$?$?$?$?$?I?I?I?I?I?I?I?m?m?m?m?m?m?m??*?U????????*?U????Õ¶???*?U????ÕÛ??*?U????èèèÑÑѺºº¢¢¢?‹ttt,_H??X?¡Â >???2$HÑ¡?:Àx?H?If)¢?'[:HY2æÇ?1Ú¤˜SâN?u²ü¨±¨Æ?(]?©Ç§P?;

Return to bug 254458