File indexing completed on 2024-10-06 06:42:52
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2012-2018 Dominik Haumann <dhaumann@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include "bug286887.h" 0009 0010 #include <kateconfig.h> 0011 #include <katedocument.h> 0012 #include <kateglobal.h> 0013 #include <kateview.h> 0014 0015 #include <QTest> 0016 0017 QTEST_MAIN(BugTest) 0018 0019 using namespace KTextEditor; 0020 0021 BugTest::BugTest() 0022 : QObject() 0023 { 0024 } 0025 0026 BugTest::~BugTest() 0027 { 0028 } 0029 0030 void BugTest::initTestCase() 0031 { 0032 KTextEditor::EditorPrivate::enableUnitTestMode(); 0033 } 0034 0035 void BugTest::cleanupTestCase() 0036 { 0037 } 0038 0039 void BugTest::ctrlShiftLeft() 0040 { 0041 KTextEditor::DocumentPrivate doc(false, false); 0042 0043 // view must be visible... 0044 KTextEditor::ViewPrivate *view = static_cast<KTextEditor::ViewPrivate *>(doc.createView(nullptr)); 0045 view->show(); 0046 view->resize(400, 300); 0047 0048 // enable block mode, then set cursor after last character, then shift+left 0049 doc.clear(); 0050 view->setBlockSelection(true); 0051 view->setCursorPosition(Cursor(0, 2)); 0052 view->shiftCursorLeft(); 0053 0054 QTest::qWait(500); 0055 0056 // enable block mode, then set cursor after last character, then delete word left 0057 doc.clear(); 0058 view->setBlockSelection(true); 0059 view->setCursorPosition(Cursor(0, 2)); 0060 view->deleteWordLeft(); 0061 0062 QTest::qWait(500); 0063 0064 // disable wrap-cursor, then set cursor after last character, then shift+left 0065 doc.clear(); 0066 view->setBlockSelection(false); 0067 view->setCursorPosition(Cursor(0, 2)); 0068 view->shiftCursorLeft(); 0069 0070 QTest::qWait(500); 0071 0072 // disable wrap-cursor, then set cursor after last character, then delete word left 0073 doc.clear(); 0074 view->setCursorPosition(Cursor(0, 2)); 0075 view->deleteWordLeft(); 0076 } 0077 0078 #include "moc_bug286887.cpp"