Exemplo n.º 1
0
        public void GetEnumerator_generic_version()
        {
            var data = new[] { 1f, 2f };
            var graphicStream = new GraphicStream<float>(GraphicStreamUsage.Color, data);

            Assert.IsNotNull(graphicStream);
            Assert.AreElementsEqual(data, graphicStream);
        }
Exemplo n.º 2
0
        public void GetEnumerator()
        {
            var data = new[] { 1f, 2f };
            var graphicStream = new GraphicStream<float>(
                GraphicStreamUsage.Color, data) as IEnumerable;
            var enumerator = graphicStream.GetEnumerator();

            Assert.IsNotNull(enumerator);
        }
Exemplo n.º 3
0
        public void Constructor_Sets_Usage_And_Data()
        {
            var usage = GraphicStreamUsage.Position;
            var data = new[] { 1f, 2f, 3f, 4f };

            var graphicStream = new GraphicStream<float>(usage, data);

            Assert.IsNotNull(graphicStream);
            Assert.AreEqual(usage, graphicStream.Description.Usage);
            Assert.AreEqual(data, graphicStream.Data);
        }
Exemplo n.º 4
0
        public void Constructor_Sets_Size_And_ElementSize_And_Format_For_Vector3()
        {
            var data = new[] { new Vector3(), new Vector3() };
            var graphicStream = new GraphicStream<Vector3>(GraphicStreamUsage.Color, data);

            var sizeOfVector3 = 12;

            Assert.IsNotNull(graphicStream);
            Assert.AreEqual(sizeOfVector3, graphicStream.Description.ElementSizeInBytes);
            Assert.AreEqual(sizeOfVector3 * data.Length, graphicStream.Description.TotalSizeInBytes);
            Assert.AreEqual(GraphicStreamFormat.Vector3, graphicStream.Description.Format);
        }
Exemplo n.º 5
0
        public void Constructor_Sets_Size_And_ElementSize_And_Format_For_Float()
        {
            var data = new[] { 1f, 2f };
            var graphicStream = new GraphicStream<float>(GraphicStreamUsage.Color, data);

            var sizeOfFloat = sizeof(float);

            Assert.IsNotNull(graphicStream);
            Assert.AreEqual(sizeOfFloat, graphicStream.Description.ElementSizeInBytes);
            Assert.AreEqual(sizeOfFloat * data.Length, graphicStream.Description.TotalSizeInBytes);
            Assert.AreEqual(GraphicStreamFormat.Float, graphicStream.Description.Format);
        }
Exemplo n.º 6
0
        public void Load_OnFrame_Unload_Cycle()
        {
            var deviceMock = new Mock<Device>(MockBehavior.Strict, DeviceCreationFlags.None);

            var data = new[] { 1f, 2f, 3f };
            var stream = new GraphicStream<float>(GraphicStreamUsage.Position, data);

            var buffer = new SlimDXBuffer(deviceMock.Object);

            buffer.Load(stream);

            buffer.Unload();
        }
Exemplo n.º 7
0
        public void Load_OnFrame_Unload_Cycle()
        {
            // call to initialize OpenGL
            new GLControl();

            var data = new[] { 1f, 2f, 3f };
            var stream = new GraphicStream<float>(GraphicStreamUsage.Position, data);

            var buffer = new OpenTKBuffer();

            buffer.Load(stream);
            buffer.Handle.ShouldNotEqual(OpenTKBuffer.INVALID_HANDLE);

            buffer.Unload();
            buffer.Handle.ShouldEqual(OpenTKBuffer.INVALID_HANDLE);
        }