本文整理汇总了C++中MyMoneySplit::writeXML方法的典型用法代码示例。如果您正苦于以下问题:C++ MyMoneySplit::writeXML方法的具体用法?C++ MyMoneySplit::writeXML怎么用?C++ MyMoneySplit::writeXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyMoneySplit
的用法示例。
在下文中一共展示了MyMoneySplit::writeXML方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testWriteXML
void MyMoneySplitTest::testWriteXML()
{
MyMoneySplit s;
s.setPayeeId("P000001");
QList<QString> tagIdList;
tagIdList << "G000001";
s.setTagIdList(tagIdList);
s.setShares(MyMoneyMoney(96379, 100));
s.setValue(MyMoneyMoney(96379, 1000));
s.setAccountId("A000076");
s.setNumber("124");
s.setBankID("SPID");
s.setAction(MyMoneySplit::ActionDeposit);
s.setReconcileFlag(MyMoneySplit::Reconciled);
QDomDocument doc("TEST");
QDomElement el = doc.createElement("SPLIT-CONTAINER");
doc.appendChild(el);
s.writeXML(doc, el);
QCOMPARE(doc.doctype().name(), QLatin1String("TEST"));
QDomElement splitContainer = doc.documentElement();
QCOMPARE(splitContainer.tagName(), QLatin1String("SPLIT-CONTAINER"));
QCOMPARE(splitContainer.childNodes().size(), 1);
QVERIFY(splitContainer.childNodes().at(0).isElement());
QDomElement split = splitContainer.childNodes().at(0).toElement();
QCOMPARE(split.tagName(), QLatin1String("SPLIT"));
QCOMPARE(split.attribute("payee"), QLatin1String("P000001"));
QCOMPARE(split.attribute("reconcileflag"), QLatin1String("2"));
QCOMPARE(split.attribute("shares"), QLatin1String("96379/100"));
QCOMPARE(split.attribute("reconciledate"), QString());
QCOMPARE(split.attribute("action"), QLatin1String("Deposit"));
QCOMPARE(split.attribute("bankid"), QLatin1String("SPID"));
QCOMPARE(split.attribute("account"), QLatin1String("A000076"));
QCOMPARE(split.attribute("number"), QLatin1String("124"));
QCOMPARE(split.attribute("value"), QLatin1String("96379/1000"));
QCOMPARE(split.attribute("memo"), QString());
QCOMPARE(split.attribute("id"), QString());
QCOMPARE(split.childNodes().size(), 1);
QVERIFY(split.childNodes().at(0).isElement());
QDomElement tag = split.childNodes().at(0).toElement();
QCOMPARE(tag.tagName(), QLatin1String("TAG"));
QCOMPARE(tag.attribute("id"), QLatin1String("G000001"));
QCOMPARE(tag.childNodes().size(), 0);
QString ref = QString(
"<!DOCTYPE TEST>\n"
"<SPLIT-CONTAINER>\n"
" <SPLIT payee=\"P000001\" reconcileflag=\"2\" shares=\"96379/100\" reconciledate=\"\" action=\"Deposit\" bankid=\"SPID\" account=\"A000076\" number=\"124\" value=\"96379/1000\" memo=\"\" id=\"\">\n"
" <TAG id=\"G000001\"/>\n"
" </SPLIT>\n"
"</SPLIT-CONTAINER>\n");
}