1/* This file is part of the KDE libraries
2 Copyright (C) 2012 Dominik Haumann <dhaumann kde org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#include "bug286887.h"
21#include "moc_bug286887.cpp"
22
23#include <qtest_kde.h>
24
25#include <katedocument.h>
26#include <kateglobal.h>
27#include <kateview.h>
28#include <kateconfig.h>
29
30QTEST_KDEMAIN(BugTest, GUI)
31
32using namespace KTextEditor;
33
34BugTest::BugTest()
35 : QObject()
36{
37}
38
39BugTest::~BugTest()
40{
41}
42
43void BugTest::initTestCase()
44{
45 KateGlobal::self()->incRef();
46}
47
48void BugTest::cleanupTestCase()
49{
50 KateGlobal::self()->decRef();
51}
52
53void BugTest::ctrlShiftLeft()
54{
55 KateDocument doc(false, false, false);
56
57 // view must be visible...
58 KateView* view = static_cast<KateView*>(doc.createView(0));
59 view->show();
60 view->resize(400, 300);
61
62 // enable block mode, then set cursor after last character, then shift+left
63 doc.clear();
64 view->setBlockSelection(true);
65 view->setCursorPosition(Cursor(0, 2));
66 view->shiftCursorLeft();
67
68 QTest::qWait(500);
69
70 // enable block mode, then set cursor after last character, then delete word left
71 doc.clear();
72 view->setBlockSelection(true);
73 view->setCursorPosition(Cursor(0, 2));
74 view->deleteWordLeft();
75
76 QTest::qWait(500);
77
78 // disable wrap-cursor, then set cursor after last character, then shift+left
79 doc.clear();
80 view->setBlockSelection(false);
81 view->setCursorPosition(Cursor(0, 2));
82 view->shiftCursorLeft();
83
84 QTest::qWait(500);
85
86 // disable wrap-cursor, then set cursor after last character, then delete word left
87 doc.clear();
88 view->setCursorPosition(Cursor(0, 2));
89 view->deleteWordLeft();
90}
91
92