project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestImageMakefileView.java
changeset 610 bfb3ab3f70f2
parent 0 fb279309251b
child 611 5d967503c150
equal deleted inserted replaced
609:bf7dbec89c47 610:bfb3ab3f70f2
    24 import com.nokia.carbide.cpp.epoc.engine.preprocessor.*;
    24 import com.nokia.carbide.cpp.epoc.engine.preprocessor.*;
    25 import com.nokia.carbide.cpp.epoc.engine.tests.BaseTest;
    25 import com.nokia.carbide.cpp.epoc.engine.tests.BaseTest;
    26 import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.BasicIncludeFileLocator;
    26 import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.BasicIncludeFileLocator;
    27 import com.nokia.carbide.internal.cpp.epoc.engine.model.StandaloneModelProvider;
    27 import com.nokia.carbide.internal.cpp.epoc.engine.model.StandaloneModelProvider;
    28 import com.nokia.cpp.internal.api.utils.core.FileUtils;
    28 import com.nokia.cpp.internal.api.utils.core.FileUtils;
       
    29 import com.nokia.cpp.internal.api.utils.core.HostOS;
    29 
    30 
    30 import org.eclipse.cdt.make.core.makefile.IDirective;
    31 import org.eclipse.cdt.make.core.makefile.IDirective;
    31 import org.eclipse.cdt.make.core.makefile.gnu.IInclude;
    32 import org.eclipse.cdt.make.core.makefile.gnu.IInclude;
    32 import org.eclipse.core.runtime.IPath;
    33 import org.eclipse.core.runtime.IPath;
    33 import org.eclipse.core.runtime.Path;
    34 import org.eclipse.core.runtime.Path;
    97 		};
    98 		};
    98 
    99 
    99 	}
   100 	}
   100 	
   101 	
   101 	protected void makeModel(String text) {
   102 	protected void makeModel(String text) {
       
   103 		text = convertForOS(text);
   102 		IDocument document = DocumentFactory.createDocument(text);
   104 		IDocument document = DocumentFactory.createDocument(text);
   103 		model = new ImageMakefileModelFactory().createModel(path, document);
   105 		model = new ImageMakefileModelFactory().createModel(path, document);
   104 
   106 
   105 		model.parse();
   107 		model.parse();
       
   108 	}
       
   109 
       
   110 	private String convertForOS(String text) {
       
   111 		// TODO: tests should work with both slash directions on both OSes
       
   112 		if (HostOS.IS_UNIX) {
       
   113 			text = text.replaceAll("\\\\(?!\r|\n)", "/");
       
   114 			text = text.replaceAll("(?<=\\s|^)/([A-Z])", "-$1"); 
       
   115 			text = text.replaceAll("(?<=\\s|^)/(c?(\\d|,)+)", "-$1");
       
   116 		}
       
   117 		return text;
   106 	}
   118 	}
   107 	
   119 	
   108 	protected IImageMakefileView getView(IImageMakefileViewConfiguration config) {
   120 	protected IImageMakefileView getView(IImageMakefileViewConfiguration config) {
   109 		IImageMakefileView view = (IImageMakefileView) model.createView(config);
   121 		IImageMakefileView view = (IImageMakefileView) model.createView(config);
   110 		assertNotNull(view);
   122 		assertNotNull(view);
   111 		return view;
   123 		return view;
   112 	}
   124 	}
   113 	
   125 	
   114 	protected void commitTest(IImageMakefileView view, String refText) {
   126 	protected void commitTest(IImageMakefileView view, String refText) {
       
   127 		refText = convertForOS(refText);
   115 		commitTest(model, view, refText);
   128 		commitTest(model, view, refText);
       
   129 	}
       
   130 	
       
   131 	private static IPath stockRootedProjectPath;
       
   132 	private static IPath stockRootedImgPath;
       
   133 	private static IPath stockRootedSvgPath;
       
   134 	
       
   135 	static {
       
   136 		if (HostOS.IS_WIN32) {
       
   137 			stockRootedProjectPath = new Path("c:\\symbian\\9.1\\S60_3rd\\S60Ex\\Hello");
       
   138 			stockRootedImgPath = new Path("c:\\imgs\\");
       
   139 			stockRootedSvgPath = new Path("c:\\svgs\\");
       
   140 		} else {
       
   141 			stockRootedProjectPath = new Path("/home/me/Hello");
       
   142 			stockRootedImgPath = new Path("/tmp/imgs/");
       
   143 			stockRootedSvgPath = new Path("/tmp/svgs/");
       
   144 		}
   116 	}
   145 	}
   117 	
   146 	
   118 	final String TEST_1 =
   147 	final String TEST_1 =
   119 		"# ============================================================================\r\n" + 
   148 		"# ============================================================================\r\n" + 
   120 		"#  Name     : Icons_aif_scalable_dc.mk\r\n" + 
   149 		"#  Name     : Icons_aif_scalable_dc.mk\r\n" + 
   568 		"HEADERDIR=$(EPOCROOT)epoc32\\include\r\n"+
   597 		"HEADERDIR=$(EPOCROOT)epoc32\\include\r\n"+
   569 		"\r\n" + 
   598 		"\r\n" + 
   570 		"ICONDIR=..\\aif\r\n" + 
   599 		"ICONDIR=..\\aif\r\n" + 
   571 		"\r\n" + 
   600 		"\r\n" + 
   572 		"$(ICONTARGETFILENAME): $(ICONDIR)\\icon1.svg $(ICONDIR)\\icon2.svg\r\n" + 
   601 		"$(ICONTARGETFILENAME): $(ICONDIR)\\icon1.svg $(ICONDIR)\\icon2.svg\r\n" + 
   573 		"	mifconv $< /E /Bbmconv.exe /h$(HEADERDIR)/Birthdays_aif.mbg /c16 $@\r\n" + 
   602 		"	mifconv $< /E /Bbmconv.exe /H$(HEADERDIR)/Birthdays_aif.mbg /c16 $@\r\n" + 
   574 		"	mifconv extra.mif /c8,8 /Fbitmaps.txt\r\n" + 
   603 		"	mifconv extra.mif /c8,8 /Fbitmaps.txt\r\n" + 
   575 		"FREEZE : do_nothing\r\n" + 
   604 		"FREEZE : do_nothing\r\n" + 
   576 		"\r\n" + 
   605 		"\r\n" + 
   577 		"SAVESPACE : do_nothing\r\n" + 
   606 		"SAVESPACE : do_nothing\r\n" + 
   578 		"\r\n" + 
   607 		"\r\n" + 
   581 		"\r\n" + 
   610 		"\r\n" + 
   582 		"FINAL : do_nothing\r\n" + 
   611 		"FINAL : do_nothing\r\n" + 
   583 		"\r\n"; 
   612 		"\r\n"; 
   584 		
   613 		
   585 	final String TEST_2_inc =
   614 	final String TEST_2_inc =
   586 		"\t../pix/bitmap1.bmp\t\nbitmap2.bmp\\\n/1,1\nc:\\test\\dot.bmp\t\n";
   615 		"\t../pix/bitmap1.bmp\t\nbitmap2.bmp\\\n/1,1\n"+stockRootedImgPath.append("dot.bmp")+"\t\n";
   587 	
   616 	
   588 	public void testImageContainerParsing2()throws Exception {
   617 	public void testImageContainerParsing2()throws Exception {
   589 		File incFile = new File(projectPath.toFile(), "group/bitmaps.txt");
   618 		File incFile = new File(projectPath.toFile(), "group/bitmaps.txt");
   590 		incFile.getParentFile().mkdir();
   619 		incFile.getParentFile().mkdir();
   591 		incFile.delete();
   620 		incFile.delete();
   592 		FileUtils.writeFileContents(incFile, TEST_2_inc.toCharArray(), null);
   621 		FileUtils.writeFileContents(incFile, convertForOS(TEST_2_inc).toCharArray(), null);
   593 		
   622 		
   594 		makeModel(TEST_2);
   623 		makeModel(TEST_2);
   595 		IImageMakefileView view = (IImageMakefileView) model.createView(viewConfig);
   624 		IImageMakefileView view = (IImageMakefileView) model.createView(viewConfig);
   596 
   625 
   597 		_testImageContainerParsing2(view);
   626 		_testImageContainerParsing2(view);
   606 		///////
   635 		///////
   607 		IMultiImageSource c = mis.get(0);
   636 		IMultiImageSource c = mis.get(0);
   608 		assertEquals(EGeneratedHeaderFlags.Header, c.getHeaderFlags());
   637 		assertEquals(EGeneratedHeaderFlags.Header, c.getHeaderFlags());
   609 		// default value not represented
   638 		// default value not represented
   610 		assertNull(c.getGeneratedHeaderFilePath());
   639 		assertNull(c.getGeneratedHeaderFilePath());
   611 		assertEquals(new Path("epoc32\\include\\Birthdays_aif.mbg"), c.getDefaultGeneratedHeaderFilePath());
   640 		assertEquals(new Path("epoc32/include/Birthdays_aif.mbg"), c.getDefaultGeneratedHeaderFilePath());
   612 		assertEquals("Birthdays_aif.mif", c.getTargetFile());
   641 		assertEquals("Birthdays_aif.mif", c.getTargetFile());
   613 		assertEquals(new Path("resource/apps"),
   642 		assertEquals(new Path("resource/apps"),
   614 				c.getTargetPath());
   643 				c.getTargetPath());
   615 		
   644 		
   616 		List<IImageSource> sources = c.getSources();
   645 		List<IImageSource> sources = c.getSources();
   661 		b = (IBitmapSource) sources.get(2);
   690 		b = (IBitmapSource) sources.get(2);
   662 		assertTrue(b.isValid());
   691 		assertTrue(b.isValid());
   663 		assertFalse(b.isColor());
   692 		assertFalse(b.isColor());
   664 		assertEquals(1, b.getDepth());
   693 		assertEquals(1, b.getDepth());
   665 		assertEquals(1, b.getMaskDepth());
   694 		assertEquals(1, b.getMaskDepth());
   666 		assertEquals(new Path("c:/test/dot.bmp"), b.getPath());
   695 		assertEquals(stockRootedImgPath.append("dot.bmp"), b.getPath());
   667 		assertNull(b.getMaskPath());
   696 		assertNull(b.getMaskPath());
   668 		assertEquals(new Path("c:/test/dot_mask.bmp"), b.getDefaultMaskPath());
   697 		assertEquals(stockRootedImgPath.append("dot_mask.bmp"), b.getDefaultMaskPath());
   669 	}
   698 	}
   670 
   699 
   671 	// alternate style uses \\epoc32 directly
   700 	// alternate style uses /epoc32 directly
   672  	final String TEST_3 = 
   701  	final String TEST_3 = 
   673  		"# ============================================================================\r\n" + 
   702  		"# ============================================================================\r\n" + 
   674  			"#  Name     : Icons_aif_scalable_dc.mk\r\n" + 
   703  			"#  Name     : Icons_aif_scalable_dc.mk\r\n" + 
   675  			"#  Part of  : Birthdays\r\n" + 
   704  			"#  Part of  : Birthdays\r\n" + 
   676  			"#\r\n" + 
   705  			"#\r\n" + 
   710  			"LIB : do_nothing\r\n" + 
   739  			"LIB : do_nothing\r\n" + 
   711  			"\r\n" + 
   740  			"\r\n" + 
   712  			"CLEANLIB : do_nothing\r\n" + 
   741  			"CLEANLIB : do_nothing\r\n" + 
   713  			"\r\n" + 
   742  			"\r\n" + 
   714  			"RESOURCE :	\r\n" + 
   743  			"RESOURCE :	\r\n" + 
   715  			"	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \\\r\n" + 
   744  			"	mifconv $(ICONTARGETFILENAME) /H$(HEADERFILENAME) \\\r\n" + 
   716  			"		/c32 $(ICONDIR)\\qgn_menu_Birthdays.svg\r\n" + 
   745  			"		/c32 $(ICONDIR)\\qgn_menu_Birthdays.svg\r\n" + 
   717  			"		\r\n" + 
   746  			"		\r\n" + 
   718  			"FREEZE : do_nothing\r\n" + 
   747  			"FREEZE : do_nothing\r\n" + 
   719  			"\r\n" + 
   748  			"\r\n" + 
   720  			"SAVESPACE : do_nothing\r\n" + 
   749  			"SAVESPACE : do_nothing\r\n" + 
   740 		assertEquals(1, mis.size());
   769 		assertEquals(1, mis.size());
   741 		
   770 		
   742 		///////
   771 		///////
   743 		IMultiImageSource c = mis.get(0);
   772 		IMultiImageSource c = mis.get(0);
   744 		assertEquals(EGeneratedHeaderFlags.Header, c.getHeaderFlags());
   773 		assertEquals(EGeneratedHeaderFlags.Header, c.getHeaderFlags());
   745 		assertEquals(new Path("\\epoc32\\include\\Birthdays_aif.mbg"), c.getGeneratedHeaderFilePath());
   774 		assertEquals(new Path("/epoc32/include/Birthdays_aif.mbg"), c.getGeneratedHeaderFilePath());
   746 		assertEquals("Birthdays_aif.mif", c.getTargetFile());
   775 		assertEquals("Birthdays_aif.mif", c.getTargetFile());
   747 		assertEquals(new Path("/epoc32/data/z/resource/apps"),
   776 		assertEquals(new Path("/epoc32/data/z/resource/apps"),
   748 				c.getTargetPath());
   777 				c.getTargetPath());
   749 		
   778 		
   750 		List<IImageSource> sources = c.getSources();
   779 		List<IImageSource> sources = c.getSources();
   758 	}
   787 	}
   759 	
   788 	
   760 	// no extension --> svg
   789 	// no extension --> svg
   761  	final String TEST_4 = 
   790  	final String TEST_4 = 
   762  			"ifeq (WINS,$(findstring WINS, $(PLATFORM)))\r\n" + 
   791  			"ifeq (WINS,$(findstring WINS, $(PLATFORM)))\r\n" + 
   763  			"ZDIR=\\epoc32\\release\\$(PLATFORM)\\$(CFG)\\Z\r\n" + 
   792  			"ZDIR=/epoc32\\release\\$(PLATFORM)\\$(CFG)\\Z\r\n" + 
   764  			"else\r\n" + 
   793  			"else\r\n" + 
   765  			"ZDIR=\\epoc32\\data\\z\r\n" + 
   794  			"ZDIR=\\epoc32\\data\\z\r\n" + 
   766  			"endif\r\n" + 
   795  			"endif\r\n" + 
   767  			"\r\n" + 
   796  			"\r\n" + 
   768  			"TARGETDIR=$(ZDIR)\\resource\\apps\r\n" + 
   797  			"TARGETDIR=$(ZDIR)\\resource\\apps\r\n" + 
   771  			"HEADERDIR=\\epoc32\\include\r\n" + 
   800  			"HEADERDIR=\\epoc32\\include\r\n" + 
   772  			"HEADERFILENAME=$(HEADERDIR)\\Birthdays_aif.mbg\r\n" + 
   801  			"HEADERFILENAME=$(HEADERDIR)\\Birthdays_aif.mbg\r\n" + 
   773  			"\r\n" + 
   802  			"\r\n" + 
   774  			"ICONDIR=..\\gfx\r\n" + 
   803  			"ICONDIR=..\\gfx\r\n" + 
   775  			"RESOURCE :	\r\n" + 
   804  			"RESOURCE :	\r\n" + 
   776  			"	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \\\r\n" + 
   805  			"	mifconv $(ICONTARGETFILENAME) /H$(HEADERFILENAME) \\\r\n" + 
   777  			"		/c32 $(ICONDIR)\\qgn_menu_Birthdays\r\n" + 
   806  			"		/c32 $(ICONDIR)\\qgn_menu_Birthdays\r\n" + 
   778  			"		\r\n" + 
   807  			"		\r\n" + 
   779  			""; 
   808  			""; 
   780 	public void testImageContainerParsing4()throws Exception {
   809 	public void testImageContainerParsing4()throws Exception {
   781 		makeModel(TEST_4);
   810 		makeModel(TEST_4);
   866 		assertEquals(0, view.getMultiImageSources().size());
   895 		assertEquals(0, view.getMultiImageSources().size());
   867 
   896 
   868 		
   897 		
   869 		IMultiImageSource mis = view.createMultiImageSource();
   898 		IMultiImageSource mis = view.createMultiImageSource();
   870 		mis.setHeaderFlags(EGeneratedHeaderFlags.Header);
   899 		mis.setHeaderFlags(EGeneratedHeaderFlags.Header);
   871 		mis.setTargetPath(new Path("epoc32\\release\\winscw\\udeb\\sys\\bin"));
   900 		mis.setTargetPath(new Path("epoc32/release/winscw/udeb/sys/bin"));
   872 		mis.setTargetFile("miffile.mif");
   901 		mis.setTargetFile("miffile.mif");
   873 		
   902 		
   874 		view.getMultiImageSources().add(mis);
   903 		view.getMultiImageSources().add(mis);
   875 		
   904 		
   876 		ISVGSource img = mis.createSVGSource();
   905 		ISVGSource img = mis.createSVGSource();
   898 		IImageMakefileView view = (IImageMakefileView) model.createView(viewConfig);
   927 		IImageMakefileView view = (IImageMakefileView) model.createView(viewConfig);
   899 		assertEquals(0, view.getAllMacroDefinitions().length);
   928 		assertEquals(0, view.getAllMacroDefinitions().length);
   900 		assertEquals(0, view.getMultiImageSources().size());
   929 		assertEquals(0, view.getMultiImageSources().size());
   901 		
   930 		
   902 		IMultiImageSource mis = view.createMultiImageSource();
   931 		IMultiImageSource mis = view.createMultiImageSource();
   903 		mis.setTargetPath(new Path("epoc32\\release\\winscw\\udeb\\sys\\bin"));
   932 		mis.setTargetPath(new Path("epoc32/release/winscw/udeb/sys/bin"));
   904 		mis.setTargetFile("miffile.mif");
   933 		mis.setTargetFile("miffile.mif");
   905 		
   934 		
   906 		view.getMultiImageSources().add(mis);
   935 		view.getMultiImageSources().add(mis);
   907 		
   936 		
   908 		IBitmapSource bmp = mis.createBitmapSource();
   937 		IBitmapSource bmp = mis.createBitmapSource();
   927 	}
   956 	}
   928 	
   957 	
   929 	public void testRootProject() {
   958 	public void testRootProject() {
   930 		// make sure we handle project root correctly when it's the root directory
   959 		// make sure we handle project root correctly when it's the root directory
   931 		for (int i = 0; i < 2; i++){
   960 		for (int i = 0; i < 2; i++){
   932 			parserConfig.projectPath = i == 0 ? new Path("c:\\") : new Path("c:");
   961 			if (HostOS.IS_WIN32)
   933 			this.path = new Path("c:\\symbian\\9.1\\S60_3rd\\S60Ex\\Hello\\group\\Icons.mk");
   962 				parserConfig.projectPath = i == 0 ? new Path("c:\\") : new Path("c:");
       
   963 			else
       
   964 				parserConfig.projectPath = new Path("/");
       
   965 			this.path = stockRootedProjectPath.append("/group/Icons.mk");
   934 			makeModel("RESOURCE:\n"+
   966 			makeModel("RESOURCE:\n"+
   935 					"\tmifconv hello.mif /c8,8 ../gfx/file.svg\n");
   967 					"\tmifconv hello.mif /c8,8 ../gfx/file.svg\n");
   936 			
   968 			
   937 			IImageMakefileView view =model.createView(this.viewConfig);
   969 			IImageMakefileView view =model.createView(this.viewConfig);
   938 			_testRootProject(view);
   970 			_testRootProject(view);
   941 	}
   973 	}
   942 
   974 
   943 	private void _testRootProject(IImageMakefileData imageMakefileData) {
   975 	private void _testRootProject(IImageMakefileData imageMakefileData) {
   944 		IImageSource source = imageMakefileData.getMultiImageSources().get(0).getSources().get(0);
   976 		IImageSource source = imageMakefileData.getMultiImageSources().get(0).getSources().get(0);
   945 		// important to be relative
   977 		// important to be relative
   946 		assertEquals(new Path("symbian/9.1/S60_3rd/S60Ex/Hello/gfx/file.svg"), source.getPath());
   978 		IPath relBase;
       
   979 		relBase = stockRootedProjectPath.makeRelative();
       
   980 		assertEquals(relBase.append("/gfx/file.svg"), source.getPath());
   947 	}
   981 	}
   948 	
   982 	
   949 	public void testMifconvBugs() {
   983 	public void testMifconvBugs() {
   950 		makeModel("RESOURCE:\n"+
   984 		makeModel("RESOURCE:\n"+
   951 		"\tmifconv hello.mif /c8,8 c:\\imgs\\foo.bmp /c32 c:\\svgs\\foo.svg\n");
   985 		"\tmifconv hello.mif /c8,8 "+stockRootedImgPath.append("foo.bmp").toOSString()
       
   986 		+" /c32 "+stockRootedSvgPath.append("foo.svg") + "\n");
   952 		IImageMakefileView view =model.createView(this.viewConfig);
   987 		IImageMakefileView view =model.createView(this.viewConfig);
   953 
   988 
   954 		IImageSource source = view.getMultiImageSources().get(0).getSources().get(0);
   989 		IImageSource source = view.getMultiImageSources().get(0).getSources().get(0);
   955 		// BMPs can have drive letter on input...
   990 		// BMPs can have drive letter on input...
   956 		assertEquals(new Path("c:/imgs/foo.bmp"), source.getPath());
   991 		assertEquals(stockRootedImgPath.append("foo.bmp"), source.getPath());
   957 		source.setMaskDepth(1);
   992 		source.setMaskDepth(1);
   958 
   993 
   959 		source = view.getMultiImageSources().get(0).getSources().get(1);
   994 		source = view.getMultiImageSources().get(0).getSources().get(1);
   960 		// SVGs can have drive letter on input...
   995 		// SVGs can have drive letter on input...
   961 		assertEquals(new Path("c:/svgs/foo.svg"), source.getPath());
   996 		assertEquals(stockRootedSvgPath.append("foo.svg"), source.getPath());
   962 
   997 
   963 		// drop drive letters on output for bmps
   998 		// drop drive letters on output for bmps
   964 		commitTest(view, "RESOURCE:\n"+
   999 		IPath outBmpPath = stockRootedImgPath.append("foo.bmp").setDevice(null);
   965 		"\tmifconv hello.mif \\\n\t/c8,1 \\imgs\\foo.bmp \\\n\t/c32 c:\\svgs\\foo.svg\n");
  1000 		IPath outSvgPath = stockRootedSvgPath.append("foo.svg");
       
  1001 		String refText = "RESOURCE:\n"+
       
  1002 		"\tmifconv hello.mif \\\n\t/c8,1 "+HostOS.convertPathToWindows(outBmpPath) + " " 
       
  1003 		+ "\\\n\t/c32 " + HostOS.convertPathToWindows(outSvgPath) + "\n";
       
  1004 		commitTest(view, refText);
   966 		
  1005 		
   967 		
  1006 		
   968 	}
  1007 	}
   969 	
  1008 	
   970 	public void testDeleteTargets() {
  1009 	public void testDeleteTargets() {
  1258 	public void testPreserveUnknownOptionsAndExpandingParameterFile() throws Exception {
  1297 	public void testPreserveUnknownOptionsAndExpandingParameterFile() throws Exception {
  1259 		String bitmapFile = "/c8,8 file1.bmp file2.bmp";
  1298 		String bitmapFile = "/c8,8 file1.bmp file2.bmp";
  1260 		File incFile = new File(projectPath.toFile(), "group/bitmaps.txt");
  1299 		File incFile = new File(projectPath.toFile(), "group/bitmaps.txt");
  1261 		incFile.getParentFile().mkdir();
  1300 		incFile.getParentFile().mkdir();
  1262 		incFile.delete();
  1301 		incFile.delete();
  1263 		FileUtils.writeFileContents(incFile, bitmapFile.toCharArray(), null);
  1302 		FileUtils.writeFileContents(incFile, convertForOS(bitmapFile).toCharArray(), null);
  1264 
  1303 
  1265 		makeModel("target:\n"+
  1304 		makeModel("target:\n"+
  1266 				"\tmifconv foo.mif /X /GOO /B /Smyencode.exe /H\\noob.h /Fbitmaps.txt");
  1305 				"\tmifconv foo.mif /X /GOO /B /Smyencode.exe /H\\noob.h /Fbitmaps.txt");
  1267 		IImageMakefileView view = model.createView(this.viewConfig);
  1306 		IImageMakefileView view = model.createView(this.viewConfig);
  1268 		assertEquals(1, view.getMultiImageSources().size()); 
  1307 		assertEquals(1, view.getMultiImageSources().size()); 
  1321 				"		/c8,1 qgn_prop_nrtyp_date\r\n";
  1360 				"		/c8,1 qgn_prop_nrtyp_date\r\n";
  1322 
  1361 
  1323 		File incFile = new File(projectPath.toFile(), "inc/Icons_generic.mk");
  1362 		File incFile = new File(projectPath.toFile(), "inc/Icons_generic.mk");
  1324 		incFile.getParentFile().mkdir();
  1363 		incFile.getParentFile().mkdir();
  1325 		incFile.delete();
  1364 		incFile.delete();
  1326 		FileUtils.writeFileContents(incFile, incl.toCharArray(), null);
  1365 		FileUtils.writeFileContents(incFile, convertForOS(incl).toCharArray(), null);
  1327 		
  1366 		
  1328 		File normFile = new File(projectPath.toFile(), "group/Icons_scalable.mk");
  1367 		File normFile = new File(projectPath.toFile(), "group/Icons_scalable.mk");
  1329 		normFile.getParentFile().mkdir();
  1368 		normFile.getParentFile().mkdir();
  1330 		normFile.delete();
  1369 		normFile.delete();
  1331 		FileUtils.writeFileContents(normFile, text.toCharArray(), null);
  1370 		FileUtils.writeFileContents(normFile, convertForOS(text).toCharArray(), null);
  1332 
  1371 
  1333 		parserConfig.fileLocator = new BasicIncludeFileLocator(
  1372 		parserConfig.fileLocator = new BasicIncludeFileLocator(
  1334 				new File[] { projectPath.append("inc").toFile() },
  1373 				new File[] { projectPath.append("inc").toFile() },
  1335 				new File[0] );
  1374 				new File[0] );
  1336 		path = projectPath.append("group/Icons_scalable.mk");
  1375 		path = projectPath.append("group/Icons_scalable.mk");
  1360 				"		/c8,1 qgn_prop_nrtyp_date\r\n";
  1399 				"		/c8,1 qgn_prop_nrtyp_date\r\n";
  1361 
  1400 
  1362 		File incFile = new File(projectPath.toFile(), "inc/Icons_generic.mk");
  1401 		File incFile = new File(projectPath.toFile(), "inc/Icons_generic.mk");
  1363 		incFile.getParentFile().mkdir();
  1402 		incFile.getParentFile().mkdir();
  1364 		incFile.delete();
  1403 		incFile.delete();
  1365 		FileUtils.writeFileContents(incFile, incl.toCharArray(), null);
  1404 		FileUtils.writeFileContents(incFile, convertForOS(incl).toCharArray(), null);
  1366 		
  1405 		
  1367 		File normFile = new File(projectPath.toFile(), "group/Icons_scalable.mk");
  1406 		File normFile = new File(projectPath.toFile(), "group/Icons_scalable.mk");
  1368 		normFile.getParentFile().mkdir();
  1407 		normFile.getParentFile().mkdir();
  1369 		normFile.delete();
  1408 		normFile.delete();
  1370 		FileUtils.writeFileContents(normFile, text.toCharArray(), null);
  1409 		FileUtils.writeFileContents(normFile, convertForOS(text).toCharArray(), null);
  1371 
  1410 
  1372 		parserConfig.fileLocator = new BasicIncludeFileLocator(
  1411 		parserConfig.fileLocator = new BasicIncludeFileLocator(
  1373 				new File[] { projectPath.append("inc").toFile() },
  1412 				new File[] { projectPath.append("inc").toFile() },
  1374 				new File[0] );
  1413 				new File[0] );
  1375 		path = projectPath.append("group/Icons_scalable.mk");
  1414 		path = projectPath.append("group/Icons_scalable.mk");
  1415 				"		/c8,1 qgn_prop_nrtyp_date\r\n";
  1454 				"		/c8,1 qgn_prop_nrtyp_date\r\n";
  1416 
  1455 
  1417 		File normFile = new File(projectPath.toFile(), "group/Icons_scalable.mk");
  1456 		File normFile = new File(projectPath.toFile(), "group/Icons_scalable.mk");
  1418 		normFile.getParentFile().mkdir();
  1457 		normFile.getParentFile().mkdir();
  1419 		normFile.delete();
  1458 		normFile.delete();
  1420 		FileUtils.writeFileContents(normFile, text.toCharArray(), null);
  1459 		FileUtils.writeFileContents(normFile, convertForOS(text).toCharArray(), null);
  1421 
  1460 
  1422 		parserConfig.fileLocator = new BasicIncludeFileLocator(
  1461 		parserConfig.fileLocator = new BasicIncludeFileLocator(
  1423 				new File[] { projectPath.append("inc").toFile() },
  1462 				new File[] { projectPath.append("inc").toFile() },
  1424 				new File[0] );
  1463 				new File[0] );
  1425 		path = projectPath.append("group/Icons_scalable.mk");
  1464 		path = projectPath.append("group/Icons_scalable.mk");
  1448 		// make the file
  1487 		// make the file
  1449 		//
  1488 		//
  1450 		File incFile = new File(projectPath.toFile(), "inc/Icons_generic.mk");
  1489 		File incFile = new File(projectPath.toFile(), "inc/Icons_generic.mk");
  1451 		incFile.getParentFile().mkdir();
  1490 		incFile.getParentFile().mkdir();
  1452 		incFile.delete();
  1491 		incFile.delete();
  1453 		FileUtils.writeFileContents(incFile, incl.toCharArray(), null);
  1492 		FileUtils.writeFileContents(incFile, convertForOS(incl).toCharArray(), null);
  1454 		
  1493 		
  1455 		// revert the view and be sure we can get the file now
  1494 		// revert the view and be sure we can get the file now
  1456 
  1495 
  1457 		view.revert();
  1496 		view.revert();
  1458 		
  1497 		
  1486 				"		/c8,1 qgn_prop_nrtyp_date\r\n";
  1525 				"		/c8,1 qgn_prop_nrtyp_date\r\n";
  1487 
  1526 
  1488 		File normFile = new File(projectPath.toFile(), "group/Icons_scalable.mk");
  1527 		File normFile = new File(projectPath.toFile(), "group/Icons_scalable.mk");
  1489 		normFile.getParentFile().mkdir();
  1528 		normFile.getParentFile().mkdir();
  1490 		normFile.delete();
  1529 		normFile.delete();
  1491 		FileUtils.writeFileContents(normFile, text.toCharArray(), null);
  1530 		FileUtils.writeFileContents(normFile, convertForOS(text).toCharArray(), null);
  1492 
  1531 
  1493 		parserConfig.fileLocator = new BasicIncludeFileLocator(
  1532 		parserConfig.fileLocator = new BasicIncludeFileLocator(
  1494 				new File[] { projectPath.append("inc").toFile() },
  1533 				new File[] { projectPath.append("inc").toFile() },
  1495 				new File[0] );
  1534 				new File[0] );
  1496 		path = projectPath.append("group/Icons_scalable.mk");
  1535 		path = projectPath.append("group/Icons_scalable.mk");
  1522 		
  1561 		
  1523 		view.commit();
  1562 		view.commit();
  1524 
  1563 
  1525 		// the model should go into the main file, and the include removed
  1564 		// the model should go into the main file, and the include removed
  1526 		String newText = new String(FileUtils.readFileContents(normFile, null));
  1565 		String newText = new String(FileUtils.readFileContents(normFile, null));
  1527 		assertEquals("\r\n" + 
  1566 		assertEquals(convertForOS("\r\n" + 
  1528 				"SECURITY_FLAG=on\r\n" + 
  1567 				"SECURITY_FLAG=on\r\n" + 
  1529 				"SCALABLE_FLAG=on\r\n" + 
  1568 				"SCALABLE_FLAG=on\r\n" + 
  1530 				"\r\n" + 
  1569 				"\r\n" + 
  1531 				"foo.mif: \\\r\n" + 
  1570 				"foo.mif: \\\r\n" + 
  1532 				"		qgn_prop_nrtyp_date\r\n" + 
  1571 				"		qgn_prop_nrtyp_date\r\n" + 
  1533 				"	mifc$(SECURITY_FLAG)v foo.mif  \\\r\n" + 
  1572 				"	mifc$(SECURITY_FLAG)v foo.mif  \\\r\n" + 
  1534 				"		 /c8,1 qgn_prop_nrtyp_date\r\n" + 
  1573 				"		 /c8,1 qgn_prop_nrtyp_date\r\n" + 
  1535 				"", newText);
  1574 				""), convertForOS(newText));
  1536 		
  1575 		
  1537 		// the include is unchanged
  1576 		// the include is unchanged
  1538 		String newIncl = new String(FileUtils.readFileContents(incFile, null));
  1577 		String newIncl = new String(FileUtils.readFileContents(incFile, null));
  1539 		assertEquals(incl, newIncl);
  1578 		assertEquals(convertForOS(incl), convertForOS(newIncl));
  1540 		
  1579 		
  1541 		referencedFiles = view.getReferencedFiles();
  1580 		referencedFiles = view.getReferencedFiles();
  1542 		assertEquals(1, referencedFiles.length);
  1581 		assertEquals(1, referencedFiles.length);
  1543 		
  1582 		
  1544 	}
  1583 	}