#include "tst_cstlcompilerif.h" #include #include void TST_CSTLCompilerIf::test() { { CWF::Variant var(1); QMap objects({{"var", &var}}); QByteArray r = CWF::CSTLCompiler(buildHtml(), QDir().currentPath(), objects, false).output(); QVERIFY2(r.contains("One"), "Should contains 'One'"); QVERIFY2(r.contains("Greater than Zero"), "Should contains 'Greater than Zero'"); QVERIFY2(r.contains("Less Two"), "Should contains 'Less Two'"); QVERIFY2(r.contains("Less equal Two"), "Should contains 'Less equal Two'"); QVERIFY2(r.contains("Greater equal One"), "Should contains 'Greater equal One'"); QVERIFY2(!r.contains("Test"), "Should not contains 'Test'"); } } QByteArray TST_CSTLCompilerIf::buildHtml() { QByteArray html; html = ""; html += ""; html += ""; html += "Test"; html += ""; html += ""; html += "One"; html += ""; html += "Greater than Zero"; html += ""; html += ""; html += ""; html += ""; html += ""; html += "Greater equal One"; html += ""; html += "Less equal Two"; html += ""; html += "Less Two"; html += ""; html += ""; html += ""; return html; }