mirror of
https://github.com/QuasarApp/Patronum.git
synced 2025-05-10 05:59:35 +00:00
fix Controler
This commit is contained in:
parent
fe1af1c51c
commit
f4bdb709f0
1
.gitignore
vendored
1
.gitignore
vendored
@ -31,6 +31,7 @@ ui_*.h
|
||||
*.jsc
|
||||
Makefile*
|
||||
*build-*
|
||||
Tests/build/
|
||||
*.qm
|
||||
*.prl
|
||||
|
||||
|
@ -15,7 +15,7 @@ Controller::~Controller() {
|
||||
delete d_ptr;
|
||||
}
|
||||
|
||||
bool Controller::send(int argc, const char **argv) {
|
||||
bool Controller::send(int argc, char **argv) {
|
||||
if (!QuasarAppUtils::Params::parseParams(argc, argv)) {
|
||||
return false;
|
||||
}
|
||||
@ -93,6 +93,7 @@ void Controller::handleFeatures(const QList<Feature> &features) {
|
||||
}
|
||||
|
||||
QuasarAppUtils::Help::print(options);
|
||||
QCoreApplication::exit(0);
|
||||
}
|
||||
|
||||
void Controller::handleResponce(const QVariantMap &responce) {
|
||||
@ -103,7 +104,7 @@ void Controller::handleResponce(const QVariantMap &responce) {
|
||||
}
|
||||
|
||||
QuasarAppUtils::Help::print(options);
|
||||
|
||||
QCoreApplication::exit(0);
|
||||
}
|
||||
|
||||
QString Controller::defaultInstallLocation() {
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
* @param argv - arguments list
|
||||
* @return true if all sendet seccussful
|
||||
*/
|
||||
bool send(int argc, const char **argv);
|
||||
bool send(int argc, char **argv);
|
||||
|
||||
/**
|
||||
* @brief waitForResponce - waut for get a responce from servece
|
||||
|
@ -60,7 +60,12 @@ bool ControllerPrivate::sendCmd(const QList<Feature> &result) {
|
||||
}
|
||||
|
||||
bool Patronum::ControllerPrivate::waitForResponce(int msec) {
|
||||
_responce = false;
|
||||
if (!dynamic_cast<QCoreApplication*>(QCoreApplication::instance())) {
|
||||
QuasarAppUtils::Params::log("Before run the waitForResponce method you need run a exec method of your QApplication class.",
|
||||
QuasarAppUtils::Warning);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
qint64 waitFor = QDateTime::currentMSecsSinceEpoch() + msec;
|
||||
|
||||
|
Binary file not shown.
@ -43,7 +43,7 @@ void testPatronum::testPing() {
|
||||
};
|
||||
DefaultController cli;
|
||||
|
||||
QVERIFY(cli.send(2 , arg));
|
||||
QVERIFY(cli.send(2 , const_cast<char**>(arg)));
|
||||
QVERIFY(cli.waitForResponce(1000));
|
||||
QVERIFY(cli.getResponce().value("Result") == "pong");
|
||||
}
|
||||
@ -55,7 +55,7 @@ void testPatronum::testRandomCommad() {
|
||||
};
|
||||
DefaultController cli;
|
||||
|
||||
QVERIFY(cli.send(2 , arg));
|
||||
QVERIFY(cli.send(2 , const_cast<char**>(arg)));
|
||||
QVERIFY(cli.waitForResponce(1000));
|
||||
QVERIFY(cli.getResponce().contains("Error"));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user