diff --git a/components/synedit/test/testbasicsynedit.pas b/components/synedit/test/testbasicsynedit.pas index 82cd2fc44d..4a14e0a17a 100644 --- a/components/synedit/test/testbasicsynedit.pas +++ b/components/synedit/test/testbasicsynedit.pas @@ -48,6 +48,7 @@ type procedure TestEditTabs; procedure TestEditEcChar; procedure TestPhysicalLogical; // TODO adjust to char tests + procedure TestPhysicalLogicalCaretMove; procedure TestLogicalAdjust; procedure TestCaretObject; procedure TestCaretAutoMove; @@ -794,6 +795,38 @@ begin TestPhysLog('bidi line (mixed arab/latin)',2, 15, 4, 0, 24, 0, 24, 0, 4, 0); end; +procedure TTestBasicSynEdit.TestPhysicalLogicalCaretMove; +begin + SetLines([ +'//', +'// X あsf//', +'//😁X あsf//', +'//', +'' + ]); + + SynEdit.Options := SynEdit.Options + [eoKeepCaretX] - [eoScrollPastEol]; + + SetCaretPhys(8, 2); + TestIsCaretPhys('(1st)', 8, 2); + TestIsCaret('(1st)', 9, 2); + + SynEdit.CommandProcessor(ecDown, '', nil); + TestIsCaretPhys('(1st)', 7, 3); + TestIsCaret('(1st)', 9, 3); + SynEdit.CommandProcessor(ecDown, '', nil); + TestIsCaretPhys('(1st)', 3, 4); + + SynEdit.CommandProcessor(ecUp, '', nil); + TestIsCaretPhys('(1st)', 7, 3); + TestIsCaret('(1st)', 9, 3); + SynEdit.CommandProcessor(ecUp, '', nil); + TestIsCaretPhys('(1st)', 8, 2); + TestIsCaret('(1st)', 9, 2); + + +end; + procedure TTestBasicSynEdit.TestLogicalAdjust; var tb: TSynEditStrings; @@ -1145,7 +1178,7 @@ var TestCaret.LineCharPos := point(X, Y); if ChangeToLine > 0 then TestCaret.LinePos := ChangeToLine; if UseLock then TestCaret.Unlock; - end; + end;♠ procedure DoOneSetByte(Y, X, {%H-}O: Integer; ChangeToLine: Integer = -1); begin if UseLock then TestCaret.Lock; @@ -1498,6 +1531,22 @@ var begin FPersistSel := False; + //(* + TestOrder := 6; + UseLock := True; + UseAdjustToNextChar := False; + UseIncAdjustToNextChar := False; + UseAllowPastEOL := False; + UseIncAllowPastEOL := False; + UseKeepCaretX := True; + UseChangeOnTouch := False; + UseIncAutoMoveOnEdit := False; + UseSkipTabs := False; + UseMaxLeft := False; + DoTests; + exit; + //*) + for TestOrder := 0 to 11 do // CheckAtPos (8) only runs first 4 for UseLock := low(Boolean) to high(Boolean) do for UseAdjustToNextChar := low(Boolean) to high(Boolean) do