Tests: build without -Wextra warnings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 10:13:56 +02:00
co-authored by Claude Opus 5.5
parent cfea9ece99
commit cef7d384bb
3 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ using namespace Qt::StringLiterals;
namespace {
const TextContext Field{.field = true};
const TextContext Field{.field = true, .hasSurroundingText = false, .textBeforeCursor = {}}; // reports no text
// A field with some text already: no auto-shift until a test asks for it.
const TextContext MidSentence{.field = true, .hasSurroundingText = true, .textBeforeCursor = u"so"_s};
+12 -4
View File
@@ -15,6 +15,14 @@ KeyDef key(qreal width = 1.0, KeyType type = KeyType::Character)
return k;
}
Layer layerOf(const QList<Row> &rows)
{
Layer layer;
layer.name = u"l"_s;
layer.rows = rows;
return layer;
}
} // namespace
class TestKeyGeometry : public QObject
@@ -24,7 +32,7 @@ class TestKeyGeometry : public QObject
private Q_SLOTS:
void fillsWidthAndHeight()
{
const Layer layer{u"l"_s, {{key(), key()}, {key(2)}}};
const Layer layer = layerOf({{key(), key()}, {key(2)}});
const KeyboardMetrics metrics{.padding = 10, .gap = 10};
const auto rects = computeKeyRects(layer, {210, 110}, metrics);
@@ -36,7 +44,7 @@ private Q_SLOTS:
void spacersShiftFollowingKeys()
{
const Layer layer{u"l"_s, {{key(), key(), key()}, {key(0.5, KeyType::Spacer), key(), key(1.5)}}};
const Layer layer = layerOf({{key(), key(), key()}, {key(0.5, KeyType::Spacer), key(), key(1.5)}});
const auto rects = computeKeyRects(layer, {300, 100}, {.padding = 0, .gap = 0});
QCOMPARE(rects[4].left(), 50.0);
QCOMPARE(rects[5].right(), 300.0);
@@ -44,7 +52,7 @@ private Q_SLOTS:
void shorterRowsAreCentered()
{
const Layer layer{u"l"_s, {{key(), key(), key(), key()}, {key(), key()}}};
const Layer layer = layerOf({{key(), key(), key(), key()}, {key(), key()}});
const auto rects = computeKeyRects(layer, {400, 100}, {.padding = 0, .gap = 0});
QCOMPARE(rects[4].left(), 100.0);
QCOMPARE(rects[5].right(), 300.0);
@@ -54,7 +62,7 @@ private Q_SLOTS:
{
KeyDef wide = key();
wide.stretch = true;
const Layer layer{u"l"_s, {{key(), key(), key(), key()}, {key(), wide}}};
const Layer layer = layerOf({{key(), key(), key(), key()}, {key(), wide}});
const auto rects = computeKeyRects(layer, {400, 100}, {.padding = 0, .gap = 0});
QCOMPARE(rects[4].left(), 0.0);
QCOMPARE(rects[5].width(), 300.0);
+1 -1
View File
@@ -127,7 +127,7 @@ private Q_SLOTS:
void fullModeKeepsDeadKeysAndKeymapShift()
{
const Layout sk = TestLayouts::build("sk", KeyboardMode::Full);
const KeyDef &acute = letterKey(sk, u"´"_s);
const KeyDef acute = letterKey(sk, u"´"_s);
QCOMPARE(acute.dead, quint32(XKB_KEY_dead_acute));
QCOMPARE(acute.deadShifted, quint32(XKB_KEY_dead_caron));
QCOMPARE(letterKey(sk, u"ô"_s).shifted, u"\""); // as the physical key