当前位置: 首页>>代码示例>>C++>>正文


C++ MyMoneySplit::matchedTransaction方法代码示例

本文整理汇总了C++中MyMoneySplit::matchedTransaction方法的典型用法代码示例。如果您正苦于以下问题:C++ MyMoneySplit::matchedTransaction方法的具体用法?C++ MyMoneySplit::matchedTransaction怎么用?C++ MyMoneySplit::matchedTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MyMoneySplit的用法示例。


在下文中一共展示了MyMoneySplit::matchedTransaction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testReplaceId

void MyMoneySplitTest::testReplaceId()
{
  MyMoneySplit s;
  bool changed;

  s.setPayeeId("P000001");
  s.setAccountId("A000076");

  changed = s.replaceId("X0001", "Y00001");
  QVERIFY(changed == false);
  QVERIFY(s.payeeId() == "P000001");
  QVERIFY(s.accountId() == "A000076");

  changed = s.replaceId("P000002", "P000001");
  QVERIFY(changed == true);
  QVERIFY(s.payeeId() == "P000002");
  QVERIFY(s.accountId() == "A000076");

  changed = s.replaceId("A000079", "A000076");
  QVERIFY(changed == true);
  QVERIFY(s.payeeId() == "P000002");
  QVERIFY(s.accountId() == "A000079");

  QString ref_ok = QString(
                     "<!DOCTYPE TEST>\n"
                     "<SPLIT-CONTAINER>\n"
                     "  <SPLIT payee=\"P000001\" reconciledate=\"\" shares=\"-125000/100\" action=\"Transfer\" bankid=\"A000076-2010-03-05-b6850c0-1\" number=\"\" reconcileflag=\"1\" memo=\"UMBUCHUNG\" value=\"-125000/100\" id=\"S0001\" account=\"A000076\" >\n"
                     "   <KEYVALUEPAIRS>\n"
                     "    <PAIR key=\"kmm-match-split\" value=\"S0002\" />\n"
                     "    <PAIR key=\"kmm-matched-tx\" value=\"&amp;lt;!DOCTYPE MATCH>\n"
                     "    &amp;lt;CONTAINER>\n"
                     "     &amp;lt;TRANSACTION postdate=&quot;2010-03-05&quot; memo=&quot;UMBUCHUNG&quot; id=&quot;&quot; commodity=&quot;EUR&quot; entrydate=&quot;2010-03-08&quot; >\n"
                     "      &amp;lt;SPLITS>\n"
                     "       &amp;lt;SPLIT payee=&quot;P000010&quot; reconciledate=&quot;&quot; shares=&quot;125000/100&quot; action=&quot;Transfer&quot; bankid=&quot;&quot; number=&quot;&quot; reconcileflag=&quot;0&quot; memo=&quot;UMBUCHUNG&quot; value=&quot;125000/100&quot; id=&quot;S0001&quot; account=&quot;A000087&quot; />\n"
                     "       &amp;lt;SPLIT payee=&quot;P000011&quot; reconciledate=&quot;&quot; shares=&quot;-125000/100&quot; action=&quot;&quot; bankid=&quot;A000076-2010-03-05-b6850c0-1&quot; number=&quot;&quot; reconcileflag=&quot;0&quot; memo=&quot;UMBUCHUNG&quot; value=&quot;-125000/100&quot; id=&quot;S0002&quot; account=&quot;A000076&quot; />\n"
                     "      &amp;lt;/SPLITS>\n"
                     "      &amp;lt;KEYVALUEPAIRS>\n"
                     "       &amp;lt;PAIR key=&quot;Imported&quot; value=&quot;true&quot; />\n"
                     "      &amp;lt;/KEYVALUEPAIRS>\n"
                     "     &amp;lt;/TRANSACTION>\n"
                     "    &amp;lt;/CONTAINER>\n"
                     "\" />\n"
                     "    <PAIR key=\"kmm-orig-memo\" value=\"\" />\n"
                     "   </KEYVALUEPAIRS>\n"
                     "  </SPLIT>\n"
                     "</SPLIT-CONTAINER>\n"
                   );
  QDomDocument doc;
  QDomElement node;
  doc.setContent(ref_ok);
  node = doc.documentElement().firstChild().toElement();

  try {
    s = MyMoneySplit(node);
    QVERIFY(s.payeeId() == "P000001");
    QVERIFY(s.replaceId("P2", "P1") == false);
    QVERIFY(s.matchedTransaction().splits()[0].payeeId() == "P000010");
    QVERIFY(s.matchedTransaction().splits()[1].payeeId() == "P000011");
    QVERIFY(s.replaceId("P0010", "P000010") == true);
    QVERIFY(s.matchedTransaction().splits()[0].payeeId() == "P0010");
    QVERIFY(s.matchedTransaction().splits()[1].payeeId() == "P000011");
    QVERIFY(s.replaceId("P0011", "P000011") == true);
    QVERIFY(s.matchedTransaction().splits()[0].payeeId() == "P0010");
    QVERIFY(s.matchedTransaction().splits()[1].payeeId() == "P0011");

  } catch (const MyMoneyException &) {
    QFAIL("Unexpected exception");
  }
}
开发者ID:CGenie,项目名称:kmymoney,代码行数:69,代码来源:mymoneysplittest.cpp


注:本文中的MyMoneySplit::matchedTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。