Пример #1
0
    public void WrapWords_DoubleWidthCharacters_UsesUnicodeWidth()
    {
        var text    = "每个人都有他的作战策略,直到脸上中了一拳。";
        var wrapped = WordWrapping.WrapWords(text, 20).Select(l => l.Text);

        Assert.Equal(
            new[]
        {
            "每个人都有他的作战策",
            "略,直到脸上中了一拳",
            "。",
        },
            wrapped
            );
    }
Пример #2
0
    public void WrapWords_WithNewLines_SplitsAtNewLines()
    {
        var text    = "Here is some\ntext that should be wrapped word by\nword. supercalifragilisticexpialidocious";
        var wrapped = WordWrapping.WrapWords(text, 20).Select(l => l.Text);

        Assert.Equal(
            new[]
        {
            "Here is some",
            "text that should be",
            "wrapped word by",
            "word.",
            "supercalifragilistic",
            "expialidocious",
        },
            wrapped
            );
    }
Пример #3
0
    public void WrapWords_GivenLongText_WrapsWords()
    {
        var text    = "Here is some text that should be wrapped word by word. supercalifragilisticexpialidocious";
        var wrapped = WordWrapping.WrapWords(text, 20).Select(l => l.Text);

        Assert.Equal(
            new[]
        {
            "Here is some text",
            "that should be",
            "wrapped word by",
            "word.",
            "supercalifragilistic",
            "expialidocious",
        },
            wrapped
            );
    }