test: extend coverage for file/qt/xml utilities and core audio/math

Add/extend tests for:
- FileFunctions: config/temp paths, autorecovery, directory overwrite/copy
- QtUtils: word wrap, formatted date/time, qHash for rational/TimeRange
- XMLUtils: cancel atom integration
- Core rational: construction, arithmetic, comparisons, NaN handling
- Core SampleBuffer: allocation, channel ops, volume/silence/reverse/speed

Coverage improvements:
- filefunctions.cpp: 74% -> 90%
- qtutils.cpp: 41% -> 73%
- xmlutils.cpp: 88% -> 100%
- rational.cpp: 74% -> 92%
- samplebuffer.cpp: 55% -> 96%
This commit is contained in:
2026-07-13 10:19:30 +08:00
parent c57608b8f8
commit 942ffd1635
6 changed files with 586 additions and 0 deletions
+25
View File
@@ -58,3 +58,28 @@ TEST(CommonXmlUtils, ReadNextStartElementSkipsUnknown)
EXPECT_TRUE(olive::XMLReadNextStartElement(&reader));
EXPECT_EQ(reader.name().toString(), QStringLiteral("known"));
}
TEST(CommonXmlUtils, ReadNextStartElementWithCancel)
{
QByteArray xml = "<root><child/></root>";
QBuffer buffer(&xml);
buffer.open(QIODevice::ReadOnly);
QXmlStreamReader reader(&buffer);
olive::CancelAtom atom;
EXPECT_TRUE(olive::XMLReadNextStartElement(&reader, &atom));
EXPECT_EQ(reader.name().toString(), QStringLiteral("root"));
}
TEST(CommonXmlUtils, ReadNextStartElementRespectsCancel)
{
QByteArray xml = "<root><child/></root>";
QBuffer buffer(&xml);
buffer.open(QIODevice::ReadOnly);
QXmlStreamReader reader(&buffer);
olive::CancelAtom atom;
atom.Cancel();
EXPECT_FALSE(olive::XMLReadNextStartElement(&reader, &atom));
}