FileDocCategorySizeDatePackage
BaseLocationBoxTest.javaAPI Docmp4parser 1.0-RC-171842Wed Dec 19 20:10:22 GMT 2012com.googlecode.mp4parser.boxes.ultraviolet

BaseLocationBoxTest

public class BaseLocationBoxTest extends com.googlecode.mp4parser.boxes.BoxWriteReadBase

Fields Summary
Constructors Summary
Methods Summary
public java.lang.ClassgetBoxUnderTest()

        return BaseLocationBox.class;
    
public voidsetupProperties(java.util.Map addPropsHere, BaseLocationBox box)

        addPropsHere.put("baseLocation", " ");
        addPropsHere.put("purchaseLocation", " ");
    
public voidtestSimple()

        BaseLocationBox bloc = new BaseLocationBox();
        bloc.setBaseLocation("baseloc");
        bloc.setPurchaseLocation("purchloc");
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bloc.getBox(Channels.newChannel(baos));
        byte[] boxAsBytes = baos.toByteArray();
        ByteBuffer bb = (ByteBuffer.wrap(boxAsBytes));
        long lengthWritten = IsoTypeReader.readUInt32(bb);
        Assert.assertEquals("bloc", IsoTypeReader.read4cc(bb));
        BaseLocationBox bloc2 = new BaseLocationBox();
        bloc2.parse(new ByteBufferByteChannel(bb), null, lengthWritten - 8, null);

        Assert.assertEquals(lengthWritten, bloc2.getSize());
        Assert.assertEquals(lengthWritten, bloc.getSize());

        Assert.assertEquals(bloc.getBaseLocation(), bloc2.getBaseLocation());
        Assert.assertEquals(bloc.getPurchaseLocation(), bloc2.getPurchaseLocation());

        Assert.assertTrue(bloc.equals(bloc2));