Пример #1
0
        public void ShouldThrowInvalidOperationExceptionOnDeserializeGlyphsWhenBufferIsNonEmpty()
        {
            using (var buffer = new Buffer())
            {
                buffer.AddUtf8("A");

                Assert.Throws <InvalidOperationException>(() => { buffer.DeserializeGlyphs(SerializedSimpleText); });
            }
        }
Пример #2
0
        public void ShouldDeserializeGlyphs()
        {
            using (var buffer = new Buffer())
            {
                buffer.DeserializeGlyphs(SerializedSimpleText);

                Assert.Equal(SimpleText.Length, buffer.Length);

                Assert.Equal(0u, buffer.GlyphInfos[0].Cluster);
                Assert.Equal(25u, buffer.GlyphInfos[0].Codepoint);

                Assert.Equal(1u, buffer.GlyphInfos[1].Cluster);
                Assert.Equal(26u, buffer.GlyphInfos[1].Codepoint);

                Assert.Equal(2u, buffer.GlyphInfos[2].Cluster);
                Assert.Equal(27u, buffer.GlyphInfos[2].Codepoint);

                Assert.Equal(3u, buffer.GlyphInfos[3].Cluster);
                Assert.Equal(28u, buffer.GlyphInfos[3].Codepoint);
            }
        }