diff options
author | deva <deva> | 2009-08-31 11:33:57 +0000 |
---|---|---|
committer | deva <deva> | 2009-08-31 11:33:57 +0000 |
commit | 86bd08d47842e5681835412ac6c08d7135a6adc5 (patch) | |
tree | 767a04c8e126d152bab922629a65a4f3e02d0953 /client/test/util.h | |
parent | 6cbc11417ee97c50fadedc1cb976f15a0c69fecc (diff) |
Initial attempt on a unit test system.
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")); |