#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace NAMESPACE; QString format(QString txt, int indent = 2, int cpl = 60) { QStringList res; QStringList lines(txt.split('\n')); QString ind(indent, ' '); Q_FOREACH(QString line, lines) { line.insert(0, ind); for (int pos(0); line.size()-pos>cpl; ++pos) { pos=line.lastIndexOf(' ', pos+cpl); line.remove(pos, 1); line.insert(pos, "\n"+ind); } res+=line; } return res.join('\n'); } QString format(std::string txt, int indent = 2, int cpl = 60) { return format(QString::fromStdString(txt), indent, cpl); } QString help(const Script& s) { std::ostringstream ss; ss<<"Synopsis"<] [ [ [...]]]"<", "xmlfile")); parser.addOption(QCommandLineOption (QStringList()<<"r"<<"retries", "on error retry up to times", "maxretries", "0")); parser.addOption(QCommandLineOption (QStringList()<<"W"<<"width", "set screenshot size to pixel", "width", "2048")); parser.addOption(QCommandLineOption (QStringList()<<"H"<<"height", "set screenshot size to pixel", "height", "2048")); parser.addOption(QCommandLineOption (QStringList()<<"v"<<"version", "show version information")); parser.addOption(QCommandLineOption (QStringList()<<"s"<<"skipped", "treat skipped test cases as failure in XML output file")); parser.addOption(QCommandLineOption (QStringList()<<"t"<<"target-path", "set screenshot target path to ", "path", QDir().absolutePath()+QDir::separator()+"attachments")); parser.process(a); if (parser.isSet("version")) { std::cout<<*argv<mainFrame(), testsuite, target+QDir::separator()+QFileInfo(file).baseName(), true, retries); testsuite.attr("failures") = "0"; script.log("SUCCESS: "+file); } } catch (std::exception& e) { script.log("FAILED: "+file+" with "+e.what()); xml::Node failure("failure"); failure.attr("message") = Script::xmlattr(e.what()).toStdString(); testsuite[testsuite.children()-1]<