aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2024-07-28 09:48:13 +1000
committerNeil <nyamatongwe@gmail.com>2024-07-28 09:48:13 +1000
commit1cccf5165b891eb95c85932474bb872ab0fbe638 (patch)
tree1772ba118f46766cd81814f69ee413a5556e1e06 /test
parent76ef74bc44e201562320906ca18d3add7084ff8b (diff)
downloadscintilla-mirror-1cccf5165b891eb95c85932474bb872ab0fbe638.tar.gz
Add SCI_GETUNDOSEQUENCE to determine whether an undo sequence is active and its
nesting depth.
Diffstat (limited to 'test')
-rw-r--r--test/simpleTests.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/simpleTests.py b/test/simpleTests.py
index 1ca5b76cb..ce67edfde 100644
--- a/test/simpleTests.py
+++ b/test/simpleTests.py
@@ -221,6 +221,25 @@ class TestSimple(unittest.TestCase):
self.assertEqual(self.ed.CanRedo(), 0)
self.assertEqual(self.ed.CanUndo(), 1)
+ def testUndoSequence(self):
+ data = b"xy"
+ self.assertEqual(self.ed.UndoSequence, 0)
+ self.ed.InsertText(0, data)
+ self.assertEqual(self.ed.UndoSequence, 0)
+ # Check that actions between BeginUndoAction and EndUndoAction are undone together
+ self.ed.BeginUndoAction()
+ self.assertEqual(self.ed.UndoSequence, 1)
+ self.ed.InsertText(0, data)
+ self.ed.InsertText(1, data)
+ # xxyyxy
+ self.assertEqual(self.ed.Length, 6)
+ self.ed.EndUndoAction()
+ self.assertEqual(self.ed.UndoSequence, 0)
+ self.ed.Undo()
+ # xy as 2 inserts removed
+ self.assertEqual(self.ed.Length, 2)
+ self.assertEqual(self.ed.UndoSequence, 0)
+
def testUndoSavePoint(self):
data = b"xy"
self.assertEqual(self.ed.Modify, 0)