添加测试

This commit is contained in:
2026-01-05 02:55:21 +08:00
parent 9d0790370f
commit 1f679551f2
20 changed files with 784 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#include <gtest/gtest.h>
#include <QBuffer>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include "common/xmlutils.h"
TEST(CommonXmlUtils, ReadNextStartElement)
{
QByteArray xml = "<root><child>value</child></root>";
QBuffer buffer(&xml);
buffer.open(QIODevice::ReadOnly);
QXmlStreamReader reader(&buffer);
EXPECT_TRUE(XMLReadNextStartElement(&reader));
EXPECT_EQ(reader.name().toString(), QStringLiteral("root"));
EXPECT_TRUE(XMLReadNextStartElement(&reader));
EXPECT_EQ(reader.name().toString(), QStringLiteral("child"));
}