Commit 51fb3c99 authored by Tomaz  Canabrava's avatar Tomaz Canabrava Committed by Tomaz Canabrava
Browse files

Create a test for block selection

This test currently is bogus, as soon as I reflow the Screen
object, the data is not correct. If anyone can check what I'm
doing wrong here it's appreciated.

The idea is that I pass a large string "aaa bbb ccc ddd" then
force a reflow for:

"aaa bbb
ccc ddd"

then I could copy only the column

bbb
ddd

Because the setSize did not work for that, the test is bogus.
but it's a start.
parent 17c3b962
......@@ -35,6 +35,37 @@ void ScreenTest::testLargeScreenCopyShortLine()
doLargeScreenCopyVerification(putToScreen, expectedSelection);
}
void ScreenTest::testBlockSelection()
{
Screen screen(largeScreenLines, largeScreenColumns);
const QString reallyBigTextForReflow = QStringLiteral(
"abcd efgh ijkl mnop qrst uvxz ABCD EFGH IJKL MNOP QRST UVXZ"
);
for(const auto c : reallyBigTextForReflow) {
screen.displayCharacter(c.toLatin1());
}
qDebug() << "Before reflow" << screen.text(0, 30, Screen::PlainText);
// this breaks the lines in `abcd efgh `
// reflowing everything to the lines below.
screen.setReflowLines(true);
screen.resizeImage(largeScreenLines, 10);
// This call seems to be doing something wrong, I'm missing the texts after
// the "reflow".
qDebug() << "After Reflow" << screen.text(0, 30, Screen::PlainText);
// True here means block selection.
screen.setSelectionStart(0, 0, true);
screen.setSelectionEnd(3, 0);
const QString selectedText = screen.selectedText(Screen::PlainText);
QCOMPARE(screen.selectedText(Screen::PlainText), QStringLiteral("abcd"));
}
void ScreenTest::testLargeScreenCopyEmptyLine()
{
const QString putToScreen;
......
......@@ -22,6 +22,7 @@ private Q_SLOTS:
void testLargeScreenCopyShortLine();
void testLargeScreenCopyEmptyLine();
void testLargeScreenCopyLongLine();
void testBlockSelection();
void testCursorPosition();
private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment