Fix enum serialization test

Test functions were not slots and never run. Also ajust the QCOMPARE
statements.

Change-Id: I0c6740e1a4a37f02d3460bed6254844e62268fe7
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
(cherry picked from commit e6bc158296)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit acf3d35287)
This commit is contained in:
Alexey Edelev 2023-12-10 10:21:41 +01:00 committed by Qt Cherry-pick Bot
parent 3ef4df89de
commit d8d39ce04b
1 changed files with 5 additions and 7 deletions

View File

@ -10,11 +10,10 @@
class QtProtobufEnumTypesSerializationTest : public QObject
{
Q_OBJECT
public:
private slots:
void SimpleEnumMessageSerializeTest();
void RepeatedEnumMessageTest();
private slots:
void init() {
m_serializer.reset(new QProtobufSerializer);
}
@ -23,6 +22,7 @@ private:
};
using namespace qtprotobufnamespace::tests;
using namespace Qt::Literals::StringLiterals;
void QtProtobufEnumTypesSerializationTest::SimpleEnumMessageSerializeTest()
{
@ -30,7 +30,7 @@ void QtProtobufEnumTypesSerializationTest::SimpleEnumMessageSerializeTest()
test.setLocalEnum(SimpleEnumMessage::LOCAL_ENUM_VALUE2);
QByteArray result = test.serialize(m_serializer.get());
QCOMPARE(result.size(), 2);
QCOMPARE(result.toHex().toStdString().c_str(), "0802");
QCOMPARE(result.toHex(), "0802"_ba);
}
void QtProtobufEnumTypesSerializationTest::RepeatedEnumMessageTest()
@ -44,12 +44,10 @@ void QtProtobufEnumTypesSerializationTest::RepeatedEnumMessageTest()
RepeatedEnumMessage::LOCAL_ENUM_VALUE2,
RepeatedEnumMessage::LOCAL_ENUM_VALUE3});
QByteArray result = msg.serialize(m_serializer.get());
QCOMPARE(result.toHex().toStdString().c_str(),
"0a06000102010203");
QCOMPARE(result.toHex(), "0a06000102010203"_ba);
msg.setLocalEnumList({});
result = msg.serialize(m_serializer.get());
QCOMPARE(result.toHex().toStdString().c_str(),
"");
QCOMPARE(result.toHex(), ""_ba);
}
QTEST_MAIN(QtProtobufEnumTypesSerializationTest)