Пример #1
0
        public void TestOpenSaveStroke()
        {
            var stroke = new Stroke();
            stroke.Add(new Point(1, 2));
            stroke.Add(new Point(3, 4));
            var mem = new System.IO.MemoryStream();
            var f = Obf.OpenBinaryFormat.ToMemory(mem);
            stroke.Save(f, 1);
            var bytes = mem.ToArray();
            f.Close();

            f = Obf.OpenBinaryFormat.FromBytes(bytes);
            var newStroke = new Stroke();
            newStroke.Read(f);
            Assert.True(newStroke.Count == 2);
            Assert.True(newStroke[0].X == 1);
            Assert.True(newStroke[0].Y == 2);
            Assert.True(newStroke[1].X == 3);
            Assert.True(newStroke[1].Y == 4);
        }