Fix template syntax for test case generation

This was broken by astyle in commit v4.95.0~5 (Code reformatted using
kde-dev-scripts/astyle-kdelibs. Use git blame -w 5d4c2df to show
authorship as it was before this commit., 2013-12-18), because despite
the filenames, this is not really c++ code.
wilder
Stephen Kelly 10 years ago
parent bb1eb0fa10
commit 0609bafdef
  1. 4
      autotests/proxymodeltestsuite/templates/datachanged.cpp
  2. 11
      autotests/proxymodeltestsuite/templates/init.cpp
  3. 20
      autotests/proxymodeltestsuite/templates/layoutchanged.cpp
  4. 49
      autotests/proxymodeltestsuite/templates/main.cpp
  5. 6
      autotests/proxymodeltestsuite/templates/modelreset.cpp
  6. 14
      autotests/proxymodeltestsuite/templates/rowsinserted.cpp
  7. 4
      autotests/proxymodeltestsuite/templates/rowsremoved.cpp

@ -1,8 +1,8 @@
{ {
ModelDataChangeCommand dataChangeCommand(&rootModel); ModelDataChangeCommand dataChangeCommand(&rootModel);
dataChangeCommand.setAncestorRowNumbers({{ event.rowAncestors }}); dataChangeCommand.setAncestorRowNumbers({{ event.rowAncestors }});
dataChangeCommand.setStartRow({{ event.start }}); dataChangeCommand.setStartRow({{ event.start }});
dataChangeCommand.setEndRow({{ event.end }}); dataChangeCommand.setEndRow({{ event.end }});
dataChangeCommand.doCommand(); dataChangeCommand.doCommand();
} }

@ -1,10 +1,11 @@
{ % if event.interpretString % } { {% if event.interpretString %}
ModelInsertCommand insertCommand(&rootModel); {
ModelInsertCommand insertCommand(&rootModel);
insertCommand.setStartRow(0); insertCommand.setStartRow(0);
insertCommand.interpret( insertCommand.interpret(
{{ event.interpretString }} {{ event.interpretString }}
); );
insertCommand.doCommand(); insertCommand.doCommand();
} }
{ % endif % } {% endif %}

@ -1,18 +1,18 @@
{ {
ModelLayoutChangeCommand layoutChangeCommand(&rootModel); ModelLayoutChangeCommand layoutChangeCommand(&rootModel);
layoutChangeCommand.setInitialTree( layoutChangeCommand.setInitialTree(
{{ event.interpretString }} {{ event.interpretString }}
); );
QList<ModelLayoutChangeCommand::PersistentChange> changes; QList<ModelLayoutChangeCommand::PersistentChange> changes;
{ % for change in event.changes % } {% for change in event.changes %}
{ {
ModelLayoutChangeCommand::PersistentChange change; ModelLayoutChangeCommand::PersistentChange change;
change.oldPath = {{ change.oldPath }}; change.oldPath = {{ change.oldPath }};
change.newPath = {{ change.newPath }}; change.newPath = {{ change.newPath }};
changes.append(change); changes.append(change);
} }
{ % endfor % } {% endfor %}
layoutChangeCommand.setPersistentChanges(changes); layoutChangeCommand.setPersistentChanges(changes);
layoutChangeCommand.doCommand(); layoutChangeCommand.doCommand();
} }

@ -2,42 +2,27 @@
#include <QApplication> #include <QApplication>
#include <dynamictreemodel.h> #include <dynamictreemodel.h>
int main(int argc, char **argv) int main (int argc, char **argv)
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
DynamicTreeModel rootModel; DynamicTreeModel rootModel;
{ {% if initEvent %} {% with initEvent as event %}
% if initEvent % // Include {{ "init.cpp" }}: {% include "init.cpp" %}
} { {% endwith %} {% endif %}
% with initEvent as event %
}
// Include {{ "init.cpp" }}: {% include "init.cpp" %}
{
% endwith %
} {
% endif %
}
// Create and connect the proxy model here. // Create and connect the proxy model here.
// eg: // eg:
// QSortFilterProxyModel proxy; // QSortFilterProxyModel proxy;
// proxy.setDynamicSortFilter(true); // proxy.setDynamicSortFilter(true);
// proxy.setSourceModel(&rootModel); // proxy.setSourceModel(&rootModel);
// Have {{ events|length }} Events.
{% for event in events %} {% with event.type|lower|stringformat:"%1.cpp" as eventtemplate %}
// Include {{ eventtemplate }}: {% include eventtemplate %}
{% endwith %} {% endfor %}
// Have {{ events|length }} Events.
{
% for event in events %
} {
% with event.type | lower | stringformat: "%1.cpp" as eventtemplate %
}
// Include {{ eventtemplate }}: {% include eventtemplate %}
{
% endwith %
} {
% endfor %
}
return app.exec(); return app.exec();
} }

@ -1,8 +1,8 @@
{ {
ModelResetCommand resetCommand(&rootModel); ModelResetCommand resetCommand(&rootModel);
resetCommand.setInitialTree( resetCommand.setInitialTree(
{{ event.interpretString }} {{ event.interpretString }}
); );
resetCommand.doCommand(); resetCommand.doCommand();
} }

@ -1,14 +1,14 @@
{ {
ModelInsertCommand insertCommand(&rootModel); ModelInsertCommand insertCommand(&rootModel);
insertCommand.setAncestorRowNumbers({{ event.rowAncestors }}); insertCommand.setAncestorRowNumbers({{ event.rowAncestors }});
insertCommand.setStartRow({{ event.start }}); insertCommand.setStartRow({{ event.start }});
{ % if event.interpretString % } {% if event.interpretString %}
insertCommand.interpret( insertCommand.interpret(
{{ event.interpretString }} {{ event.interpretString }}
); );
{ % else % } {% else %}
insertCommand.setEnd({{ event.end }}); insertCommand.setEnd({{ event.end }});
{ % endif % } {% endif %}
insertCommand.doCommand(); insertCommand.doCommand();
} }

@ -1,8 +1,8 @@
{ {
ModelRemoveCommand removeCommand(&rootModel); ModelRemoveCommand removeCommand(&rootModel);
removeCommand.setAncestorRowNumbers({{ event.rowAncestors }}); removeCommand.setAncestorRowNumbers({{ event.rowAncestors }});
removeCommand.setStartRow({{ event.start }}); removeCommand.setStartRow({{ event.start }});
removeCommand.setEndRow({{ event.end }}); removeCommand.setEndRow({{ event.end }});
removeCommand.doCommand(); removeCommand.doCommand();
} }

Loading…
Cancel
Save