Exemplo n.º 1
0
        public void ReadDisplayTextDifferentSizes()
        {
            // Well formed stream data
            byte[] streamData =
            {
                0,     0,   0,   0,
                123,   1,   0,   0,
                104,   1,   0,   0,
                5,     0,   0,   0,
                72,  101, 108, 108,111, 0, 0, 0
            };

            // It is ok to have a little bit more space for the text
            for (int dataSize = 21; dataSize < 24; dataSize++)
            {
                WangStream      stream = new WangStream(streamData);
                WangDisplayText read   = WangAnnotationStructureReader.ReadDisplayText(stream, dataSize);
                Assert.IsTrue(read != null);
            }
        }
Exemplo n.º 2
0
        public void ReadDisplayTextInvalidSize()
        {
            // Well formed stream data
            byte[] streamData =
            {
                0,     0,   0,   0,
                123,   1,   0,   0,
                104,   1,   0,   0,
                5,     0,   0,   0,
                72,  101, 108, 108,111, 0, 0, 0
            };

            // At least 4 values with 4 bytes are required.
            for (int dataSize = 0; dataSize < 21; dataSize++)
            {
                WangStream      stream = new WangStream(streamData);
                WangDisplayText read   = WangAnnotationStructureReader.ReadDisplayText(stream, dataSize);
                Assert.IsTrue(read == null);
            }
        }
Exemplo n.º 3
0
        public void ReadDisplayTextStdExact()
        {
            // Well formed stream data
            byte[] streamData =
            {
                0,     0,   0,   0,
                123,   1,   0,   0,
                104,   1,   0,   0,
                5,     0,   0,   0,
                72,  101, 108, 108,111, 0, 0, 0
            };

            WangStream      stream = new WangStream(streamData);
            WangDisplayText read   = WangAnnotationStructureReader.ReadDisplayText(stream, 24);

            Assert.IsTrue(read != null);

            Assert.AreEqual(0, read.Orientation);
            Assert.AreEqual("Hello", read.Text);
            Assert.AreEqual(360, (int)read.CreationScale);
            Assert.AreEqual(0, stream.AvailableBytes());
        }
Exemplo n.º 4
0
 /// <summary>
 /// SetDisplayText sets the display text.
 /// </summary>
 /// <param name="displayText">The display text.</param>
 public void SetDisplayText(WangDisplayText displayText)
 {
     _displayText = displayText;
 }