From cfdbdc7e2c4d452490c1e8da6ca3540c35dcd68e Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Thu, 20 Aug 2009 12:05:38 +0200
Subject: [PATCH] fakevim: fix broken auto tests (cherry picked from commit
 0422c8330cafde5a950c3adb27332f5c9f95d685)

---
 src/plugins/fakevim/fakevimhandler.cpp |  2 +-
 tests/auto/fakevim/main.cpp            | 39 +++++++++++---------------
 2 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index 29cc0bfe318..ee3e3216e1a 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -571,7 +571,6 @@ EventResult FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
         key += 32;
     }
 
-    m_undoCursorPosition[m_tc.document()->revision()] = m_tc.position();
     //if (m_mode == InsertMode)
     //    joinPreviousEditBlock();
     //else
@@ -656,6 +655,7 @@ void FakeVimHandler::Private::restoreWidget()
 EventResult FakeVimHandler::Private::handleKey(int key, int unmodified,
     const QString &text)
 {
+    m_undoCursorPosition[m_tc.document()->revision()] = m_tc.position();
     //qDebug() << "KEY: " << key << text << "POS: " << m_tc.position();
     if (m_mode == InsertMode)
         return handleInsertMode(key, unmodified, text);
diff --git a/tests/auto/fakevim/main.cpp b/tests/auto/fakevim/main.cpp
index 9201ba7d5e5..ef4a2f6e3cc 100644
--- a/tests/auto/fakevim/main.cpp
+++ b/tests/auto/fakevim/main.cpp
@@ -291,7 +291,6 @@ void tst_FakeVim::command_dd_2()
     move("j",    "@" + l[1]);
     check("dd",  l[0] + "\n@" + lmid(2));
     check("p",   l[0] + "\n" + l[2] + "\n@" + l[1] + "\n" + lmid(3));
-return; // FIXME
     check("u",   l[0] + "\n@" + lmid(2));
 }
 
@@ -318,8 +317,6 @@ void tst_FakeVim::command_dfx_down()
     check("df ",  l[0] + "\n#inc@<QtCore>\n" + lmid(2));
     check("j",    l[0] + "\n#inc<QtCore>\n#inc@lude <QtGui>\n" + lmid(3));
     check(".",    l[0] + "\n#inc<QtCore>\n#inc@<QtGui>\n" + lmid(3));
-    qWarning("FIXME");
-return;
     check("u",    l[0] + "\n#inc<QtCore>\n#inc@lude <QtGui>\n" + lmid(3));
     check("u",    l[0] + "\n#inc@lude <QtCore>\n" + lmid(2));
 }
@@ -366,9 +363,8 @@ void tst_FakeVim::command_i()
     // small insertion at start of document
     check("ix" + escape, "@x" + lines);
     check("u", "@" + lines);
-// FIXME redo broken
-    //check(control('r'), "@x" + lines);
-    //check("u", "@" + lines);
+    check(control('r'), "@x" + lines);
+    check("u", "@" + lines);
 
     // small insertion at start of document
     check("ixxx" + escape, "xx@x" + lines);
@@ -386,9 +382,8 @@ void tst_FakeVim::command_i()
     check("icyy" + escape, "bcy@yxa" + lines);
     check("u", "b@xa" + lines);
     check("u", "@a" + lines); 
-// FIXME undo broken
-//    checkEx("redo", "b@xa" + lines);
-//    check("u", "@a" + lines);
+    checkEx("redo", "b@xa" + lines);
+    check("u", "@a" + lines);
 }
 
 void tst_FakeVim::command_left()
@@ -470,19 +465,6 @@ return; // FIXME
     check("G",   lmid(0) + "@");
     check("yyp", lmid(0) + "@" + lmid(9, 1));
 }
-/*
-
-#include <QtCore>
-#include <QtGui>
-
-int main(int argc, char *argv[])
-{
-    QApplication app(argc, argv);
-
-    return app.exec();
-}
-*/
-
 
 void tst_FakeVim::test_i_cw_i()
 {
@@ -496,6 +478,19 @@ return; // FIXME: not in sync with Gui behaviour?
 }
 
 
+/*
+
+#include <QtCore>
+#include <QtGui>
+
+int main(int argc, char *argv[])
+{
+    QApplication app(argc, argv);
+
+    return app.exec();
+}
+*/
+
 //////////////////////////////////////////////////////////////////////////
 //
 // Main
-- 
GitLab