~ubuntu-branches/ubuntu/trusty/kate/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/vimode_test.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2014-06-04 16:48:44 UTC
  • mfrom: (1.1.46)
  • Revision ID: package-import@ubuntu.com-20140604164844-dqgx2g13surkmfhd
Tags: 4:4.13.1-0ubuntu0.1
New upstream bugfix release (LP: #1318142)

Show diffs side-by-side

added added

removed removed

Lines of Context:
785
785
    DoTest("Three. Different. Sentences.", "viscX", "X Different. Sentences.");
786
786
    DoTest("Three. Different. Sentences.", "vapcX", "X");
787
787
    DoTest("Three. Different. Sentences.", "vipcX", "X");
 
788
    DoTest("Hello.\n", "vap\\esciX", "Hello.\nX");
 
789
 
 
790
    // Get the range right.
 
791
    DoTest("\n", "vjcX", "X");
 
792
    DoTest("Hello.\nWorld", "2lvjcX", "HeXld");
 
793
    DoTest("Three. Different. Sentences.\n\n", "vapcX", "X");
788
794
}
789
795
 
790
796
void ViModeTest::ReplaceModeTests()
791
797
{
792
 
  // TODO - more of these!
793
 
  DoTest("foo bar", "R\\ctrl-\\rightX", "foo Xar");
794
 
  DoTest("foo bar", "R\\ctrl-\\right\\ctrl-\\rightX", "foo barX");
795
 
  DoTest("foo bar", "R\\ctrl-\\leftX", "Xoo bar");
796
 
  DoTest("foo bar", "R\\ctrl-\\left\\delete", "oo bar");
797
 
 
798
 
  DoTest("foo\nbar\nbaz", "R\\downX", "foo\nXar\nbaz");
799
 
  DoTest("foo\nbar\nbaz", "jjR\\upX", "foo\nXar\nbaz");
 
798
    // Basic stuff.
 
799
    DoTest("", "Rqwerty", "qwerty");
 
800
    DoTest("qwerty", "R\\rightXX", "qXXrty");
 
801
 
 
802
    // Enter replace and go to the next/previous word.
 
803
    DoTest("foo bar", "R\\ctrl-\\rightX", "foo Xar");
 
804
    DoTest("foo bar", "R\\ctrl-\\right\\ctrl-\\rightX", "foo barX");
 
805
    DoTest("foo bar", "R\\ctrl-\\leftX", "Xoo bar");
 
806
    DoTest("foo bar", "R\\ctrl-\\left\\delete", "oo bar");
 
807
 
 
808
    // Enter replace mode and go up/down.
 
809
    DoTest("foo\nbar\nbaz", "R\\downX", "foo\nXar\nbaz");
 
810
    DoTest("foo\nbar\nbaz", "jjR\\upX", "foo\nXar\nbaz");
 
811
 
 
812
    // Backspace.
 
813
    DoTest("", "R\\backspace", "");
 
814
    DoTest("qwerty", "lR\\backspaceX", "Xwerty");
 
815
    DoTest("qwerty", "lRX\\backspace\\backspaceX", "Xwerty");
 
816
 
 
817
    // Ctrl-E: replace the current column with the column of the next line.
 
818
    DoTest("", "R\\ctrl-e", "");
 
819
    DoTest("\n", "jR\\ctrl-e", "\n");
 
820
    DoTest("\nqwerty", "R\\ctrl-e\\ctrl-e", "qw\nqwerty");
 
821
    DoTest("a\nbb", "R\\ctrl-e\\ctrl-e", "bb\nbb");
 
822
    DoTest("aa\n b", "R\\ctrl-e\\ctrl-e", " b\n b");
 
823
    DoTest("\n\tb", "R\\ctrl-e\\ctrl-e", "\tb\n\tb");
 
824
 
 
825
    // Ctrl-Y: replace the current column with the column of the previous line.
 
826
    DoTest("", "R\\ctrl-y", "");
 
827
    DoTest("qwerty\n", "jR\\ctrl-y\\ctrl-y", "qwerty\nqw");
 
828
    DoTest("aa\nb", "jR\\ctrl-y\\ctrl-y", "aa\naa");
 
829
    DoTest(" a\nbb", "jR\\ctrl-y\\ctrl-y", " a\n a");
 
830
    DoTest("\tb\n", "jR\\ctrl-y\\ctrl-y", "\tb\n\tb");
 
831
 
800
832
}
801
833
 
802
834
void ViModeTest::InsertModeTests() {
2885
2917
  QApplication::sendPostedEvents();
2886
2918
  FinishTest("foo bar");
2887
2919
 
 
2920
  // Mapping the u and the U commands to other keys.
 
2921
  clearAllMappings();
 
2922
  KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "t", "u", KateViGlobal::Recursive);
 
2923
  KateGlobal::self()->viInputModeGlobal()->addMapping(KateViGlobal::NormalModeMapping, "r", "U", KateViGlobal::Recursive);
 
2924
  DoTest("", "ihello\\esct", "");
 
2925
  DoTest("", "ihello\\esctr", "hello");
 
2926
 
2888
2927
  // Clear mappings for subsequent tests.
2889
2928
  clearAllMappings();
2890
2929
}