summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestelementattribute.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 10:34:13 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 10:34:13 +0100
commit67ad0519fd165acee4a4d2a94fa502e9e4847bd0 (patch)
tree1dbf50b3dff8d5ca7e9344733968c72704eb15ff /src/testlib/qtestelementattribute.cpp
Long live Qt!
Diffstat (limited to 'src/testlib/qtestelementattribute.cpp')
-rw-r--r--src/testlib/qtestelementattribute.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/testlib/qtestelementattribute.cpp b/src/testlib/qtestelementattribute.cpp
new file mode 100644
index 0000000000..fe746efd67
--- /dev/null
+++ b/src/testlib/qtestelementattribute.cpp
@@ -0,0 +1,71 @@
+#include "qtestelementattribute.h"
+#include <QtCore/qbytearray.h>
+#include <string.h>
+#include <stdlib.h>
+
+QTestElementAttribute::QTestElementAttribute()
+ :attributeValue(0),
+ attributeIndex(QTest::AI_Undefined)
+{
+}
+
+QTestElementAttribute::~QTestElementAttribute()
+{
+ delete[] attributeValue;
+}
+
+const char *QTestElementAttribute::value() const
+{
+ return attributeValue;
+}
+
+const char *QTestElementAttribute::name() const
+{
+ const char *AttributeNames[] =
+ {
+ "name",
+ "result",
+ "tests",
+ "failures",
+ "errors",
+ "type",
+ "description",
+ "value",
+ "qtestversion",
+ "qtversion",
+ "file",
+ "line",
+ "metric",
+ "tag",
+ "value",
+ "iterations"
+ };
+
+ if(attributeIndex != QTest::AI_Undefined)
+ return AttributeNames[attributeIndex];
+
+ return 0;
+}
+
+QTest::AttributeIndex QTestElementAttribute::index() const
+{
+ return attributeIndex;
+}
+
+bool QTestElementAttribute::isNull() const
+{
+ return attributeIndex == QTest::AI_Undefined;
+}
+
+bool QTestElementAttribute::setPair(QTest::AttributeIndex index, const char *value)
+{
+ if(!value)
+ return false;
+
+ delete[] attributeValue;
+
+ attributeIndex = index;
+ attributeValue = qstrdup(value);
+
+ return (attributeValue!=0) ? true:false;
+}