forked from qt-creator/qt-creator
add some test code for the yet-to-be-born QLinkedList dumper
This commit is contained in:
@@ -226,6 +226,7 @@ private:
|
||||
void recordInsert(int position, const QString &data);
|
||||
void recordRemove(int position, const QString &data);
|
||||
void recordRemove(int position, int length);
|
||||
void recordMove(int position, int nestedCount);
|
||||
void undo();
|
||||
void redo();
|
||||
QStack<EditOperation> m_undoStack;
|
||||
@@ -671,8 +672,8 @@ void FakeVimHandler::Private::handleCommandMode(int key, const QString &text)
|
||||
QString text = m_registers[m_register];
|
||||
int n = text.count(QChar(ParagraphSeparator));
|
||||
if (n > 0) {
|
||||
m_tc.movePosition(Down);
|
||||
m_tc.movePosition(StartOfLine);
|
||||
m_tc.movePosition(Down);
|
||||
m_tc.insertText(text);
|
||||
m_tc.movePosition(Up, MoveAnchor, n);
|
||||
} else {
|
||||
@@ -680,6 +681,7 @@ void FakeVimHandler::Private::handleCommandMode(int key, const QString &text)
|
||||
m_tc.insertText(text);
|
||||
m_tc.movePosition(Left);
|
||||
}
|
||||
m_dotCommand = "p";
|
||||
} else if (key == control('r')) {
|
||||
redo();
|
||||
} else if (key == 's') {
|
||||
@@ -1292,6 +1294,15 @@ void FakeVimHandler::Private::redo()
|
||||
#endif
|
||||
}
|
||||
|
||||
void FakeVimHandler::Private::recordMove(int position, int nestedCount)
|
||||
{
|
||||
EditOperation op;
|
||||
op.m_position = position;
|
||||
op.m_itemCount = nestedCount;
|
||||
m_undoStack.push(op);
|
||||
m_redoStack.clear();
|
||||
}
|
||||
|
||||
void FakeVimHandler::Private::recordInsert(int position, const QString &data)
|
||||
{
|
||||
EditOperation op;
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QLibrary>
|
||||
#include <QtCore/QLinkedList>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtCore/QString>
|
||||
@@ -191,6 +193,38 @@ void testIO()
|
||||
std::cerr << "std::cerr 3\n";
|
||||
}
|
||||
|
||||
void testQLinkedList()
|
||||
{
|
||||
#if 1
|
||||
QLinkedList<int> li;
|
||||
QLinkedList<uint> lu;
|
||||
|
||||
for (int i = 0; i != 3; ++i)
|
||||
li.append(i);
|
||||
li.append(102);
|
||||
|
||||
|
||||
lu.append(102);
|
||||
lu.append(102);
|
||||
lu.append(102);
|
||||
|
||||
QLinkedList<qulonglong> l;
|
||||
l.append(42);
|
||||
l.append(43);
|
||||
l.append(44);
|
||||
l.append(45);
|
||||
|
||||
QLinkedList<Foo> f;
|
||||
f.append(Foo(1));
|
||||
f.append(Foo(2));
|
||||
#endif
|
||||
|
||||
QLinkedList<std::string> v;
|
||||
v.push_back("aa");
|
||||
v.push_back("bb");
|
||||
v.push_back("cc");
|
||||
v.push_back("dd");
|
||||
}
|
||||
|
||||
void testQList()
|
||||
{
|
||||
@@ -880,6 +914,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
testPlugin();
|
||||
testQList();
|
||||
testQLinkedList();
|
||||
testNamespace();
|
||||
//return 0;
|
||||
testQByteArray();
|
||||
|
||||
Reference in New Issue
Block a user