diff options
Diffstat (limited to 'client/test/util.h')
-rw-r--r-- | client/test/util.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/client/test/util.h b/client/test/util.h new file mode 100644 index 0000000..98da0e9 --- /dev/null +++ b/client/test/util.h @@ -0,0 +1,32 @@ +#include "macrowindow.h" +#include <QDomElement> + +MacroWindow *createMacroWindow(); +QDomElement getWidgetElement(QString type = "", + QString name = "", + QString value = ""); + +// +// Predefined tests +// +#define TEST_CREATION(W) \ + QDomElement n = getWidgetElement(#W, "mywidget"); \ + MacroWindow *wnd = createMacroWindow(); \ + W wgd(n, wnd); \ + +#define TEST_DISABLE(W) \ + QDomElement n = getWidgetElement(#W, "mywidget"); \ + MacroWindow *wnd = createMacroWindow(); \ + W wdg(n, wnd); \ + wdg.disable(); \ + QCOMPARE(wdg.isDisabled(), true); \ + wdg.enable(); \ + QCOMPARE(wdg.isDisabled(), false); + +#define TEST_VALUE(W) \ + QDomElement n = getWidgetElement(#W, "mywidget"); \ + MacroWindow *wnd = createMacroWindow(); \ + W wdg(n, wnd); \ + QCOMPARE(wdg.getValue(), QString("")); \ + wdg.setValue("hello", "source"); \ + QCOMPARE(wdg.getValue(), QString("hello")); |