mirror of https://github.com/qt/qtgrpc.git
Fix enum serialization test
Test functions were not slots and never run. Also ajust the QCOMPARE
statements.
Pick-to: 6.5
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>
This commit is contained in:
parent
3b8d38fcea
commit
acf3d35287
|
|
@ -10,11 +10,10 @@
|
||||||
class QtProtobufEnumTypesSerializationTest : public QObject
|
class QtProtobufEnumTypesSerializationTest : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
private slots:
|
||||||
void SimpleEnumMessageSerializeTest();
|
void SimpleEnumMessageSerializeTest();
|
||||||
void RepeatedEnumMessageTest();
|
void RepeatedEnumMessageTest();
|
||||||
|
|
||||||
private slots:
|
|
||||||
void init() {
|
void init() {
|
||||||
m_serializer.reset(new QProtobufSerializer);
|
m_serializer.reset(new QProtobufSerializer);
|
||||||
}
|
}
|
||||||
|
|
@ -23,6 +22,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
using namespace qtprotobufnamespace::tests;
|
using namespace qtprotobufnamespace::tests;
|
||||||
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
void QtProtobufEnumTypesSerializationTest::SimpleEnumMessageSerializeTest()
|
void QtProtobufEnumTypesSerializationTest::SimpleEnumMessageSerializeTest()
|
||||||
{
|
{
|
||||||
|
|
@ -30,7 +30,7 @@ void QtProtobufEnumTypesSerializationTest::SimpleEnumMessageSerializeTest()
|
||||||
test.setLocalEnum(SimpleEnumMessage::LOCAL_ENUM_VALUE2);
|
test.setLocalEnum(SimpleEnumMessage::LOCAL_ENUM_VALUE2);
|
||||||
QByteArray result = test.serialize(m_serializer.get());
|
QByteArray result = test.serialize(m_serializer.get());
|
||||||
QCOMPARE(result.size(), 2);
|
QCOMPARE(result.size(), 2);
|
||||||
QCOMPARE(result.toHex().toStdString().c_str(), "0802");
|
QCOMPARE(result.toHex(), "0802"_ba);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtProtobufEnumTypesSerializationTest::RepeatedEnumMessageTest()
|
void QtProtobufEnumTypesSerializationTest::RepeatedEnumMessageTest()
|
||||||
|
|
@ -44,12 +44,10 @@ void QtProtobufEnumTypesSerializationTest::RepeatedEnumMessageTest()
|
||||||
RepeatedEnumMessage::LOCAL_ENUM_VALUE2,
|
RepeatedEnumMessage::LOCAL_ENUM_VALUE2,
|
||||||
RepeatedEnumMessage::LOCAL_ENUM_VALUE3});
|
RepeatedEnumMessage::LOCAL_ENUM_VALUE3});
|
||||||
QByteArray result = msg.serialize(m_serializer.get());
|
QByteArray result = msg.serialize(m_serializer.get());
|
||||||
QCOMPARE(result.toHex().toStdString().c_str(),
|
QCOMPARE(result.toHex(), "0a06000102010203"_ba);
|
||||||
"0a06000102010203");
|
|
||||||
msg.setLocalEnumList({});
|
msg.setLocalEnumList({});
|
||||||
result = msg.serialize(m_serializer.get());
|
result = msg.serialize(m_serializer.get());
|
||||||
QCOMPARE(result.toHex().toStdString().c_str(),
|
QCOMPARE(result.toHex(), ""_ba);
|
||||||
"");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_MAIN(QtProtobufEnumTypesSerializationTest)
|
QTEST_MAIN(QtProtobufEnumTypesSerializationTest)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue