|
|
|
@ -17,6 +17,7 @@ |
|
|
|
|
#include <QScrollBar> |
|
|
|
|
#include <QFile> |
|
|
|
|
#include <QMessageBox> |
|
|
|
|
#include <QCompleter> |
|
|
|
|
#include <ui_testgui.hxx> |
|
|
|
|
#include <stdexcept> |
|
|
|
|
#include <QNetworkReply> |
|
|
|
@ -49,8 +50,11 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI { |
|
|
|
|
QSettings settings("mrw", "webtester"); |
|
|
|
|
restoreGeometry(settings.value("geometry").toByteArray()); |
|
|
|
|
restoreState(settings.value("windowstate").toByteArray()); |
|
|
|
|
_url->completer()->setFilterMode(Qt::MatchContains); |
|
|
|
|
_url->completer()->setCaseSensitivity(Qt::CaseInsensitive); |
|
|
|
|
_url->completer()->setCompletionMode(QCompleter::PopupCompletion); |
|
|
|
|
if (!url.isEmpty()) { |
|
|
|
|
_url->setText(url); |
|
|
|
|
storeUrl(url); |
|
|
|
|
} |
|
|
|
|
TestWebPage* page(new TestWebPage(_web)); |
|
|
|
|
_web->setPage(page); |
|
|
|
@ -70,8 +74,10 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI { |
|
|
|
|
void on__load_clicked() { |
|
|
|
|
enterText(true); |
|
|
|
|
if (_record->isChecked()) |
|
|
|
|
appendCommand("load "+map(_url->text())); |
|
|
|
|
_web->load(_url->text()); |
|
|
|
|
appendCommand("load "+map(_url->currentText())); |
|
|
|
|
storeUrl(_url->currentText()); |
|
|
|
|
_webprogress->setFormat(_url->currentText()); |
|
|
|
|
_web->load(_url->currentText()); |
|
|
|
|
} |
|
|
|
|
void on__abort_clicked() { |
|
|
|
|
enterText(true); |
|
|
|
@ -156,6 +162,9 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI { |
|
|
|
|
_status->setCurrentIndex(STATUS_SUCCESS); |
|
|
|
|
} catch (std::exception &x) { |
|
|
|
|
_status->setCurrentIndex(STATUS_ERROR); |
|
|
|
|
QMessageBox::critical(this, tr("Test Failed"), tr("Error [%1]: %2") |
|
|
|
|
.arg(demangle(typeid(x).name())) |
|
|
|
|
.arg(x.what())); |
|
|
|
|
} |
|
|
|
|
_run->setEnabled(true); |
|
|
|
|
_record->setEnabled(true); |
|
|
|
@ -202,7 +211,8 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI { |
|
|
|
|
//std::cout<<"titleChanged: "<<title.toStdString()<<std::endl;
|
|
|
|
|
} |
|
|
|
|
void on__web_urlChanged(const QUrl& url) { |
|
|
|
|
_url->setText(url.url()); |
|
|
|
|
_webprogress->setFormat(url.url()); |
|
|
|
|
storeUrl(url); |
|
|
|
|
enterText(true); |
|
|
|
|
if (_record->isChecked()) |
|
|
|
|
appendCommand("expect "+map("urlChanged "+url.url())); |
|
|
|
@ -415,6 +425,12 @@ class TestGUI: public QMainWindow, protected Ui::TestGUI { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
private: |
|
|
|
|
void storeUrl(QUrl u) { |
|
|
|
|
if (!_url->findText(u.url())) { |
|
|
|
|
_url->addItem(u.url()); |
|
|
|
|
_url->setCurrentText(u.url()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
void loadFile(QString name) { |
|
|
|
|
QFile file(name); |
|
|
|
|
try { |
|
|
|
|