コード例 #1
0
ファイル: TextEngineTest.cs プロジェクト: ywscr/Pinta
        public void PerformEnter()
        {
            var engine = new TextEngine(new List <string> ()
            {
                "foo", "bar"
            });

            engine.SetCursorPosition(new TextPosition(1, 1), true);
            engine.PerformEnter();

            Assert.AreEqual(3, engine.LineCount);
            Assert.AreEqual(LinesToString(new string[] { "foo", "b", "ar" }),
                            engine.ToString());
            Assert.AreEqual(new TextPosition(2, 0), engine.CurrentPosition);
        }
コード例 #2
0
ファイル: TextEngineTest.cs プロジェクト: ywscr/Pinta
        public void DeleteSelection()
        {
            var engine = new TextEngine(new List <string> ()
            {
                "это тест", "это еще один тест"
            });

            engine.SetCursorPosition(new TextPosition(0, 2), true);
            engine.PerformDown(true);
            engine.PerformDelete();

            Assert.AreEqual(1, engine.LineCount);
            Assert.AreEqual(LinesToString(new string[] { "это еще один тест" }),
                            engine.ToString());
            Assert.AreEqual(new TextPosition(0, 2), engine.CurrentPosition);
        }
コード例 #3
0
ファイル: TextEngineTest.cs プロジェクト: ywscr/Pinta
        public void DeleteMultiLineSelection()
        {
            var engine = new TextEngine(new List <string> ()
            {
                "line 1", "line 2", "line 3"
            });

            engine.SetCursorPosition(new TextPosition(0, 2), true);
            engine.PerformDown(true);
            engine.PerformDown(true);
            engine.PerformDelete();

            Assert.AreEqual(1, engine.LineCount);
            Assert.AreEqual(LinesToString(new string[] { "line 3" }),
                            engine.ToString());
        }