Skip to content

Commit f533fd4

Browse files
equalsrafequalsraf
authored andcommitted
Fix GuiFont test
We are observing a failing test for font changes 1. the finished signal for the call to vim_command is not caught by the signal spy The root of the issues seems to be a failure to set the font due to some combination of bad font metrics happening in the test environment. The GuiFont command was changed to force the change. The timeout was also increased.
1 parent 7a5b0dd commit f533fd4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/tst_shell.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void TestShell::guiShimCommands() noexcept
110110
QObject::connect(c->neovimObject(), &NeovimApi1::err_vim_command_output, SignalPrintError);
111111

112112
QSignalSpy cmd_font(
113-
c->neovimObject()->vim_command_output(c->encode("GuiFont")), &MsgpackRequest::finished);
113+
c->neovimObject()->vim_command_output(c->encode("GuiFont!")), &MsgpackRequest::finished);
114114
QVERIFY(cmd_font.isValid());
115115
QVERIFY2(SPYWAIT(cmd_font), "Waiting for GuiFont");
116116

@@ -121,7 +121,7 @@ void TestShell::guiShimCommands() noexcept
121121
QVERIFY2(SPYWAIT(cmd_ls), "Waiting for GuiLinespace");
122122

123123
// Test font attributes
124-
const QString cmdFontSize14{ QStringLiteral("GuiFont %1:h14").arg(GetPlatformTestFont()) };
124+
const QString cmdFontSize14{ QStringLiteral("GuiFont! %1:h14").arg(GetPlatformTestFont()) };
125125
const QString expectedFontSize14{ QStringLiteral("%1:h14").arg(GetPlatformTestFont()) };
126126
QSignalSpy cmd_gf{ c->neovimObject()->vim_command_output(c->encode(cmdFontSize14)),
127127
&MsgpackRequest::finished };
@@ -137,17 +137,17 @@ void TestShell::guiShimCommands() noexcept
137137

138138
// Normalization removes the :b attribute
139139
const QString cmdFontBoldRemoved{
140-
QStringLiteral("GuiFont %1:h14:b:l").arg(GetPlatformTestFont())
140+
QStringLiteral("GuiFont! %1:h16:b:l").arg(GetPlatformTestFont())
141141
};
142-
const QString expectedFontBoldRemoved{ QStringLiteral("%1:h14:l").arg(GetPlatformTestFont()) };
142+
const QString expectedFontBoldRemoved{ QStringLiteral("%1:h16:l").arg(GetPlatformTestFont()) };
143143
QSignalSpy spy_fontchange2(w->shell(), &ShellWidget::shellFontChanged);
144144
QSignalSpy cmd_gf2{ c->neovimObject()->vim_command_output(c->encode(cmdFontBoldRemoved)),
145145
&MsgpackRequest::finished };
146146
QVERIFY(cmd_gf2.isValid());
147147
QVERIFY(SPYWAIT(cmd_gf2, 5000));
148148

149149
// Test Performance: timeout occurs often, set value carefully.
150-
SPYWAIT(spy_fontchange2, 2500 /*msec*/);
150+
SPYWAIT(spy_fontchange2, 5000 /*msec*/);
151151

152152
QCOMPARE(w->shell()->fontDesc(), expectedFontBoldRemoved);
153153
}

0 commit comments

Comments
 (0)