Exemplo n.º 1
0
        public void TestHOG2Headers()
        {
            HOG2File hogFile = new HOG2File(TestUtils.GetResourceStream("EXTRA13.HOG"));

            //Test 1:
            Assert.AreEqual("BLpyrobottomback1.ogf", hogFile.Lumps[0].Name);
            Assert.AreEqual(1940, hogFile.Lumps[0].Size);
            Assert.AreEqual(939679392, hogFile.Lumps[0].Timestamp);

            //Test 2: Black Pyro model
            Assert.AreEqual("purplepyro.OOF", hogFile.Lumps[21].Name);
            Assert.AreEqual(31941, hogFile.Lumps[21].Size);
            Assert.AreEqual(941690214, hogFile.Lumps[21].Timestamp);
        }
Exemplo n.º 2
0
        public void TestHOG2LumpReader()
        {
            HOG2File hogFile = new HOG2File(TestUtils.GetResourceStream("EXTRA13.HOG"));

            //Test 1: OGF file, as byte array
            byte[] data = hogFile.GetLumpData(0);
            Assert.AreEqual(1940, data.Length);
            Assert.AreEqual(0, data[0]);
            Assert.AreEqual(0, data[1]);
            Assert.AreEqual(122, data[2]); //OUTRAGE_1555_COMPRESSED_MIPPED

            //Test 2: Black Pyro model, as stream
            BinaryReader br   = new BinaryReader(hogFile.GetLumpAsStream(21));
            uint         test = br.ReadUInt32();

            Assert.AreEqual(31941, br.BaseStream.Length);
            Assert.AreEqual(Util.MakeSig('P', 'S', 'P', 'O'), test);
        }
Exemplo n.º 3
0
        public void TestReadBitmapHeader()
        {
            //Test 1: Unmipped image from HOG2 file.
            HOG2File       hogFile = new HOG2File(TestUtils.GetResourceStream("EXTRA13.HOG"));
            BinaryReader   br      = new BinaryReader(hogFile.GetLumpAsStream(0));
            Descent3Bitmap bm      = Descent3Bitmap.ReadBitmapFromOGFStream(br);

            Assert.AreEqual(32, bm.Width);
            Assert.AreEqual(32, bm.Height);
            Assert.AreEqual(1, bm.MipLevels);
            Assert.AreEqual(BitmapType.Outrage1555CompressedMipped, bm.Type);
            Assert.AreEqual(ImageType.Format1555, bm.Format);
            Assert.AreEqual("BLpyrobottomback1.ogf", bm.Name);

            //Test 2: Mipped image from disk
            br.Close();

            br = new BinaryReader(TestUtils.GetResourceStream("Angle Tile 1.ogf"));
            bm = Descent3Bitmap.ReadBitmapFromOGFStream(br);

            Assert.AreEqual(128, bm.Width);
            Assert.AreEqual(128, bm.Height);
            Assert.AreEqual(5, bm.MipLevels);
            Assert.AreEqual(BitmapType.Outrage1555CompressedMipped, bm.Type);
            Assert.AreEqual("Angle Tile 1.ogf", bm.Name);
            Assert.AreEqual(ImageType.Format1555, bm.Format);

            //Test 3: unmipped 4444 image from disk
            br.Close();

            br = new BinaryReader(TestUtils.GetResourceStream("CED Grid2S.ogf"));
            bm = Descent3Bitmap.ReadBitmapFromOGFStream(br);

            Assert.AreEqual(128, bm.Width);
            Assert.AreEqual(128, bm.Height);
            Assert.AreEqual(1, bm.MipLevels);
            Assert.AreEqual(BitmapType.Outrage4444CompressedMipped, bm.Type);
            Assert.AreEqual("CED Grid2S.ogf", bm.Name);
            Assert.AreEqual(ImageType.Format4444, bm.Format);
        }
Exemplo n.º 4
0
        public void TestReadHOG2File()
        {
            HOG2File hogFile = new HOG2File(TestUtils.GetResourceStream("EXTRA13.HOG"));

            Assert.AreEqual(25, hogFile.NumLumps);
        }