use of uk.me.parabola.imgfmt.fs.FileSystem in project mkgmap by openstreetmap.
the class TYPFileTest method testWrite.
@Test
public void testWrite() throws Exception {
TestUtils.registerFile("test.typ");
FileSystemParam params = new FileSystemParam();
try (FileSystem fs = ImgFS.createFs("test.typ", params)) {
ImgChannel channel = fs.create("XXX.TYP");
TYPFile typFile = new TYPFile(channel);
assertNotNull("typ file is created", typFile);
}
}
use of uk.me.parabola.imgfmt.fs.FileSystem in project mkgmap by openstreetmap.
the class FileCopier method createGmapsupp.
/**
* Create the output file.
*
* @return The gmapsupp file.
* @throws FileNotWritableException If it cannot be created for any reason.
*/
private FileSystem createGmapsupp() throws FileNotWritableException {
// Create this file, containing all the sub files
FileSystemParam params = new FileSystemParam();
params.setMapDescription(overallDescription);
params.setGmapsupp(true);
params.setHideGmapsuppOnPC(hideGmapsuppOnPC);
params.setProductVersion(productVersion);
FileSystem outfs = ImgFS.createFs(Utils.joinPath(outputDir, GMAPSUPP), params);
mpsFile = createMpsFile(outfs);
mpsFile.setMapsetName(mapsetName);
return outfs;
}
use of uk.me.parabola.imgfmt.fs.FileSystem in project mkgmap by openstreetmap.
the class ArgsTest method testDisplayPriority.
@Test
public void testDisplayPriority() throws FileNotFoundException {
TestUtils.registerFile("osmmap.img");
int pri = 42;
Outputs op = TestUtils.run("--draw-priority=" + pri, Args.TEST_RESOURCE_OSM + "uk-test-1.osm.gz");
op.checkNoError();
FileSystem fs = openFs(Args.DEF_MAP_FILENAME);
ImgChannel chan = fs.open(Args.DEF_MAP_ID + ".TRE", "r");
TREFileReader treFile = new TREFileReader(chan);
assertEquals("display priority", pri, ((TREHeader) treFile.getHeader()).getDisplayPriority());
}
use of uk.me.parabola.imgfmt.fs.FileSystem in project mkgmap by openstreetmap.
the class SimpleTest method testPolish.
@Test
public void testPolish() throws FileNotFoundException {
Main.mainNoSystemExit(Args.TEST_STYLE_ARG, Args.TEST_RESOURCE_MP + "test1.mp");
FileSystem fs = openFs(Args.DEF_MAP_FILENAME);
assertNotNull("file exists", fs);
List<DirectoryEntry> entries = fs.list();
int count = 0;
for (DirectoryEntry ent : entries) {
String ext = ent.getExt();
int size = ent.getSize();
switch(ext) {
case "RGN":
count++;
System.out.println("RGN size " + size);
assertThat("RGN size", size, new RangeMatcher(2704));
break;
case "TRE":
count++;
System.out.println("TRE size " + size);
// Size varies depending on svn modified status
assertThat("TRE size", size, new RangeMatcher(770, 2));
break;
case "LBL":
count++;
assertEquals("LBL size", 999, size);
break;
}
}
assertTrue("enough checks run", count >= 3);
}
use of uk.me.parabola.imgfmt.fs.FileSystem in project mkgmap by openstreetmap.
the class GmapsuppTest method testWithTwoIndexes.
@Test
public void testWithTwoIndexes() throws IOException {
TestUtils.registerFile("osmmap_mdr.img", "osmmap.img", "osmmap.tbd", "osmmap.mdx");
Main.mainNoSystemExit(Args.TEST_STYLE_ARG, "--gmapsupp", "--index", "--tdbfile", "--latin1", "--family-id=101", "--product-id=1", "--family-name=tst family1", "--series-name=tst series1", Args.TEST_RESOURCE_IMG + "63240001.img", Args.TEST_RESOURCE_IMG + "63240002.img");
assertTrue(new File("osmmap_mdr.img").exists());
// All we are doing here is checking that the file was created and that it is
// not completely empty.
FileSystem fs = openFs(GMAPSUPP_IMG);
ImgChannel r = fs.open("00000101.MDR", "r");
r.position(2);
ByteBuffer buf = ByteBuffer.allocate(1024);
int read = r.read(buf);
assertEquals(1024, read);
buf.flip();
byte[] b = new byte[3];
buf.get(b, 0, 3);
assertEquals('G', b[0]);
}
Aggregations