tst_cstlcompilerout.cpp 694 B

1234567891011121314151617181920212223242526
  1. #include "tst_cstlcompilerout.h"
  2. #include <cwf/cstlcompiler.h>
  3. #include <cwf/variant.h>
  4. void TST_CSTLCompilerOut::test()
  5. {
  6. {
  7. CWF::Variant var(1);
  8. QMap<QString, QObject *> objects({{"var", &var}});
  9. QByteArray r = CWF::CSTLCompiler(buildHtml(), QDir().currentPath(), objects, false).output();
  10. QVERIFY2(r.contains("1"), "Should contains '1'");
  11. }
  12. }
  13. QByteArray TST_CSTLCompilerOut::buildHtml()
  14. {
  15. QByteArray html;
  16. html = "<html>";
  17. html += "<body>";
  18. html += "Um #{var.toInt} + #{var.toInt} = 2";
  19. html += "<a link=\"#{var.toInt} #{var.toInt} \"/>";
  20. html += "</body>";
  21. html += "</html>";
  22. return html;
  23. }