Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
496f4893
Commit
496f4893
authored
Nov 16, 2021
by
Tomaz Canabrava
Browse files
Add a test for Character
This class is severely undertested
parent
1cd4dea4
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/autotests/CMakeLists.txt
View file @
496f4893
...
...
@@ -23,6 +23,12 @@ ecm_mark_nongui_executable(CharacterWidthTest)
add_test
(
NAME CharacterWidthTest COMMAND CharacterWidthTest
)
target_link_libraries
(
CharacterWidthTest
${
KONSOLE_TEST_LIBS
}
)
add_executable
(
CharacterTest CharacterTest.cpp
)
ecm_mark_as_test
(
CharacterTest
)
ecm_mark_nongui_executable
(
CharacterTest
)
add_test
(
NAME CharacterTest COMMAND CharacterTest
)
target_link_libraries
(
CharacterTest
${
KONSOLE_TEST_LIBS
}
)
if
(
"$ENV{USER}"
STREQUAL
"jenkins"
)
message
(
STATUS
"We are running in jenkins; skipping DBusTest..."
)
else
()
...
...
src/autotests/CharacterTest.cpp
0 → 100644
View file @
496f4893
#include "CharacterTest.h"
#include "Character.h"
#include <QTest>
#include <cstdint>
void
Konsole
::
CharacterTest
::
testCanBeGrouped
()
{
// Test for Capital Latin
for
(
uint32_t
c
=
U'A'
;
c
<=
U'Z'
;
c
++
)
{
Konsole
::
Character
uppercase_latin_char
(
c
);
const
bool
res
=
uppercase_latin_char
.
canBeGrouped
(
false
,
false
);
QCOMPARE
(
res
,
true
);
}
// Test for Non Capital Latin
for
(
uint32_t
c
=
U'a'
;
c
<=
U'z'
;
c
++
)
{
Konsole
::
Character
lowercase_latin_char
(
c
);
const
bool
res
=
lowercase_latin_char
.
canBeGrouped
(
false
,
false
);
QCOMPARE
(
res
,
true
);
}
// Test for Braille
for
(
uint32_t
c
=
0x2800
;
c
<=
0x28ff
;
c
++
)
{
Konsole
::
Character
braille_char
(
c
);
const
bool
res
=
braille_char
.
canBeGrouped
(
false
,
false
);
QCOMPARE
(
res
,
false
);
// TEST FOR REGRESSION - This was failing with different bidirectional modes.
Konsole
::
Character
braille_char_bidi_enabled
(
c
);
const
bool
res2
=
braille_char_bidi_enabled
.
canBeGrouped
(
true
,
false
);
QCOMPARE
(
res2
,
false
);
}
}
QTEST_GUILESS_MAIN
(
Konsole
::
CharacterTest
)
src/autotests/CharacterTest.h
0 → 100644
View file @
496f4893
/*
SPDX-FileCopyrightText: 2019 Tomaz Canabrava <tomaz.canabrava@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QObject>
namespace
Konsole
{
class
CharacterTest
:
public
QObject
{
Q_OBJECT
private
Q_SLOTS
:
void
testCanBeGrouped
();
};
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment