summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDenis Shienkov <scapig2@yandex.ru>2011-10-23 14:42:59 +0400
committerDenis Shienkov <scapig2@yandex.ru>2011-10-23 14:42:59 +0400
commit62b3311164cf6750415ef298361a9fa1333974fd (patch)
tree763023b415cdf49292eb1d23159d33fa5d4aa75c /tests
parent5d4555dab4bed5e8e8884a0ec2df1a593247cff5 (diff)
downloadqtserialport-62b3311164cf6750415ef298361a9fa1333974fd.tar.gz
/tests/guidevtest:
1. Added about test dialog (by double clicking on test item). 2. Added tool tips. 3. Added description about "Info Test".
Diffstat (limited to 'tests')
-rw-r--r--tests/guidevtest/maindialog.cpp38
-rw-r--r--tests/guidevtest/maindialog.h12
-rw-r--r--tests/guidevtest/maindialog.ui58
-rw-r--r--tests/guidevtest/unittestinfo.cpp5
4 files changed, 103 insertions, 10 deletions
diff --git a/tests/guidevtest/maindialog.cpp b/tests/guidevtest/maindialog.cpp
index 543907d..b0497d7 100644
--- a/tests/guidevtest/maindialog.cpp
+++ b/tests/guidevtest/maindialog.cpp
@@ -1,7 +1,7 @@
#include "maindialog.h"
#include "ui_maindialog.h"
-#include <QtGui/QMessageBox>
+#include <QtGui/QTextEdit>
#include <QtCore/QSettings>
#include <QtCore/QTimer>
#include <QtCore/QFile>
@@ -161,6 +161,30 @@ bool TestsViewModel::setData(const QModelIndex &index, const QVariant &value, in
return false;
}
+QModelIndex TestsViewModel::index(int row, int column, const QModelIndex &parent) const
+{
+ Q_UNUSED(parent);
+ if (row < m_testsList.count())
+ return createIndex(row, column, m_testsList.at(row));
+ return QModelIndex();
+}
+
+
+// DescriptionDialog
+
+/* Public methods */
+
+DescriptionDialog::DescriptionDialog(const QString &content, QWidget *parent)
+ : QDialog(parent)
+{
+ QTextEdit *widget = new QTextEdit;
+ widget->setReadOnly(true);
+ widget->setText(content);
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->addWidget(widget);
+ setLayout(layout);
+}
+
// MainDialog
@@ -190,6 +214,9 @@ MainDialog::MainDialog(QWidget *parent)
connect(ui->startButton, SIGNAL(clicked()),
this, SLOT(procStartButtonClick()));
+
+ connect(ui->listView, SIGNAL(doubleClicked(QModelIndex)),
+ this, SLOT(procItemDoubleClick(QModelIndex)));
}
MainDialog::~MainDialog()
@@ -273,6 +300,15 @@ void MainDialog::procTestFinished()
procTestStarted();
}
+void MainDialog::procItemDoubleClick(const QModelIndex &index)
+{
+ QString title(tr("About: <%1>"));
+ title = title.arg(index.data().toString());
+ DescriptionDialog w(static_cast<UnitTestBase *>(index.internalPointer())->description());
+ w.setWindowTitle(title);
+ w.exec();
+}
+
/* Private methods */
const QString MainDialog::logFileSettingsKey = "MainDialog/logFileName";
diff --git a/tests/guidevtest/maindialog.h b/tests/guidevtest/maindialog.h
index e3aff19..d9175d8 100644
--- a/tests/guidevtest/maindialog.h
+++ b/tests/guidevtest/maindialog.h
@@ -24,13 +24,23 @@ public:
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole);
+ virtual QModelIndex index(int row, int column,
+ const QModelIndex &parent = QModelIndex()) const;
private:
QList<UnitTestBase *> m_testsList;
};
+class DescriptionDialog : public QDialog
+{
+public:
+ explicit DescriptionDialog(const QString &content, QWidget *parent = 0);
+};
+
+
class Logger;
+class QModelIndex;
class MainDialog : public QDialog
{
@@ -48,6 +58,8 @@ private slots:
void procTestStarted();
void procTestFinished();
+ void procItemDoubleClick(const QModelIndex &index);
+
private:
Ui::MainDialog *ui;
TestsViewModel *m_model;
diff --git a/tests/guidevtest/maindialog.ui b/tests/guidevtest/maindialog.ui
index 94f00f7..397454c 100644
--- a/tests/guidevtest/maindialog.ui
+++ b/tests/guidevtest/maindialog.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>137</width>
- <height>294</height>
+ <width>172</width>
+ <height>307</height>
</rect>
</property>
<property name="windowTitle">
@@ -24,13 +24,17 @@
<rect>
<x>0</x>
<y>0</y>
- <width>123</width>
- <height>235</height>
+ <width>152</width>
+ <height>231</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QListView" name="listView"/>
+ <widget class="QListView" name="listView">
+ <property name="toolTip">
+ <string>Double Click by test item for get a description.</string>
+ </property>
+ </widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
@@ -42,7 +46,18 @@
</widget>
</item>
<item row="0" column="1">
- <widget class="QComboBox" name="srcComboBox"/>
+ <widget class="QComboBox" name="srcComboBox">
+ <property name="toolTip">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Select source port for pair.&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#ff0000;&quot;&gt;Note:&lt;/span&gt;&lt;span style=&quot; font-size:8pt; color:#ff0000;&quot;&gt; &lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#ff0000;&quot;&gt;Source port and destination port should be different!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="dstLabel">
@@ -52,7 +67,18 @@
</widget>
</item>
<item row="1" column="1">
- <widget class="QComboBox" name="dstComboBox"/>
+ <widget class="QComboBox" name="dstComboBox">
+ <property name="toolTip">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Select destination port for pair.&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#ff0000;&quot;&gt;Note:&lt;/span&gt;&lt;span style=&quot; font-size:8pt; color:#ff0000;&quot;&gt; &lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#ff0000;&quot;&gt;Source port and destination port should be different!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="logLabel">
@@ -63,6 +89,9 @@
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="logLineEdit">
+ <property name="toolTip">
+ <string>Write here the name of the log file.</string>
+ </property>
<property name="text">
<string/>
</property>
@@ -70,6 +99,14 @@
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="clearLogCheckBox">
+ <property name="toolTip">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Clears the log file before starting the queue test.&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Otherwise, all subsequent entries will be appended to the end of file.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
<property name="text">
<string>Clear log on start.</string>
</property>
@@ -77,6 +114,11 @@
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="breakAllCheckBox">
+ <property name="toolTip">
+ <string>Terminates all the tests, if at least one test failed.
+Error condition is given by the developer within the test manually.
+Change the condition on which an error, can only change your test code and recompiling the application again.</string>
+ </property>
<property name="text">
<string>Break all on error</string>
</property>
@@ -91,7 +133,7 @@
<item>
<widget class="QPushButton" name="startButton">
<property name="text">
- <string>Start</string>
+ <string>Start tests</string>
</property>
</widget>
</item>
diff --git a/tests/guidevtest/unittestinfo.cpp b/tests/guidevtest/unittestinfo.cpp
index 851a492..d435861 100644
--- a/tests/guidevtest/unittestinfo.cpp
+++ b/tests/guidevtest/unittestinfo.cpp
@@ -9,7 +9,10 @@ UnitTestInfo::UnitTestInfo(Logger *logger, QObject *parent)
: UnitTestBase(UnitTestBase::InfoUnitId, logger, parent)
{
m_name = QString(tr("Info Test"));
- m_description = QString(tr("Info Test Description"));
+ m_description = QString(tr( "\"Info Test\" tested class SerialPortInfo,\n"
+ "by calling its methods and write the results to a log.\n\n"
+ "In the log lists all serial ports that were discovered,\n"
+ "their properties, states, and supported standard rates."));
}
/* Public slots */