Commit 9a32ead0a962b4492b68ba1ad285e55dca1b1bbf

Authored by Eric Menezes Noronha
1 parent 7d9fb6ce
Exists in master

Novos testes para executar a aplicação de maneira correta.

-Acrescentado arquivo da classe principal.
cacic-teste/cacic-teste.pro.user
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject> 2 <!DOCTYPE QtCreatorProject>
3 -<!-- Written by QtCreator 3.1.1, 2014-06-13T10:56:40. --> 3 +<!-- Written by QtCreator 3.1.1, 2014-06-16T17:56:13. -->
4 <qtcreator> 4 <qtcreator>
5 <data> 5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable> 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
cacic-teste/testcacic.cpp
@@ -16,7 +16,7 @@ void CTestCacic::installcacicTest() @@ -16,7 +16,7 @@ void CTestCacic::installcacicTest()
16 installcacicPath = "E:/Lightbase/cacic-projeto-test/build/cacic-test/debug/cacic-teste.exe"; 16 installcacicPath = "E:/Lightbase/cacic-projeto-test/build/cacic-test/debug/cacic-teste.exe";
17 installcacic.execute(installcacicPath,QStringList() << "--host:"); 17 installcacic.execute(installcacicPath,QStringList() << "--host:");
18 if (!installcacic.waitForFinished() and (installcacic.exitCode() == 5)) 18 if (!installcacic.waitForFinished() and (installcacic.exitCode() == 5))
19 - QVERIFY(installcacic.exitCode() == 5); 19 + QVERIFY(installcacic.exitStatus() == 5);
20 else 20 else
21 QSKIP("Installcacic ExitCode: " + QString::number(installcacic.exitCode()).toLocal8Bit()); 21 QSKIP("Installcacic ExitCode: " + QString::number(installcacic.exitCode()).toLocal8Bit());
22 22
install-cacic/install-cacic.pro
@@ -15,4 +15,8 @@ CONFIG -= app_bundle @@ -15,4 +15,8 @@ CONFIG -= app_bundle
15 TEMPLATE = app 15 TEMPLATE = app
16 16
17 17
18 -SOURCES += main.cpp 18 +SOURCES += main.cpp \
  19 + installcacic.cpp
  20 +
  21 +HEADERS += \
  22 + installcacic.h
install-cacic/install-cacic.pro.user
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject> 2 <!DOCTYPE QtCreatorProject>
3 -<!-- Written by QtCreator 3.1.1, 2014-06-13T11:07:45. --> 3 +<!-- Written by QtCreator 3.1.1, 2014-06-16T17:56:13. -->
4 <qtcreator> 4 <qtcreator>
5 <data> 5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable> 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
install-cacic/installcacic.cpp 0 → 100644
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
  1 +#include "installcacic.h"
  2 +
  3 +
  4 +QCoreApplication *InstallCacic::getApp() const
  5 +{
  6 + return app;
  7 +}
  8 +
  9 +void InstallCacic::setApp(const QCoreApplication &value)
  10 +{
  11 + app = value;
  12 +}
  13 +
  14 +InstallCacic::InstallCacic(QObject *parent) :
  15 + QObject(parent)
  16 +{
  17 +}
  18 +
  19 +
  20 +void InstallCacic::runInstall()
  21 +{
  22 + QString argumento;
  23 + cout << "Testando argumentos" << endl;
  24 + argumento = "--host";
  25 +
  26 + if (app.arguments().count() > 1){
  27 + for(int i=1;i<app.arguments().count();i++){
  28 + if (app.arguments().at(i) == argumento){
  29 + app.quit();
  30 + } else {
  31 + cout << app.arguments().at(i).toStdString() << endl;
  32 + }
  33 + }
  34 + app.exit(2);
  35 + } else {
  36 + app.exit(3);
  37 + }
  38 +}
  39 +
  40 +
install-cacic/installcacic.h 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +#ifndef INSTALLCACIC_H
  2 +#define INSTALLCACIC_H
  3 +
  4 +#include <QObject>
  5 +#include <QCoreApplication>
  6 +#include <iostream>
  7 +#include <QStringList>
  8 +#include <QTimer>
  9 +
  10 +using namespace std;
  11 +
  12 +class InstallCacic : public QObject
  13 +{
  14 + Q_OBJECT
  15 +public:
  16 + // variaveis
  17 +
  18 + explicit InstallCacic(QObject *parent = 0);
  19 +
  20 + QCoreApplication *getApp() const;
  21 + void setApp(const QCoreApplication &value);
  22 +
  23 +private:
  24 + QCoreApplication app;
  25 +signals:
  26 +
  27 +public slots:
  28 + void runInstall(QCoreApplication*);
  29 +
  30 +};
  31 +
  32 +#endif // INSTALLCACIC_H
install-cacic/main.cpp
1 -#include <QCoreApplication>  
2 -#include <QStringList>  
3 -#include <iostream> 1 +#include <installcacic.cpp>
4 2
5 using namespace std; 3 using namespace std;
6 4
7 int main(int argc, char *argv[]) 5 int main(int argc, char *argv[])
8 { 6 {
9 QCoreApplication a(argc, argv); 7 QCoreApplication a(argc, argv);
10 - QString argumento;  
11 - cout << "Testando argumentos" << endl;  
12 - if (a.arguments().count()>1){  
13 - for(int i=1;i<a.arguments().count();i++){  
14 - argumento = "--host";  
15 - if (a.arguments().at(i) == argumento){  
16 - return 5;  
17 - } else {  
18 - cout << a.arguments().at(i).toStdString() << endl;  
19 - }  
20 - } 8 + InstallCacic CInstallCacic;
  9 + CInstallCacic.setApp(*a);
  10 +
  11 + try {
  12 +
  13 + CInstallCacic.runInstall();// TENTAR RODAR COM CONNECT OU ALGO DO TIPO
  14 + } catch (int e) {
  15 + cout << "Error: " << e << endl;
21 } 16 }
22 17
23 - return 1;  
24 -// return a.exec(); 18 + return a.exec();
25 } 19 }