Commit 7d9fb6ceb198fea7e382ccb7f9e0ed47b0a1dbf3

Authored by Eric Menezes Noronha
1 parent a02c1fa1
Exists in master

Teste para parametros do install cacic quase pronto, basta receber o

retorno de maneira correta. O teste está recebendo sempre 0, não
identifiquei o motivo.
cacic-teste/cacic-teste.pro
... ... @@ -6,12 +6,13 @@
6 6  
7 7 QT += testlib
8 8 TARGET = cacic-teste
9   -#CONFIG += console
10 9 CONFIG -= app_bundle
11 10  
12 11 TEMPLATE = app
13 12  
14 13  
15   -SOURCES += testinstallcacic.cpp
  14 +SOURCES += \
  15 + testcacic.cpp
16 16  
17   -HEADERS += testinstallcacic.h
  17 +HEADERS += \
  18 + testcacic.h
... ...
cacic-teste/testcacic.cpp 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +#include <QProcess>
  2 +#include <QStringList>
  3 +#include "testcacic.h"
  4 +QTEST_MAIN(CTestCacic)
  5 +
  6 +CTestCacic::CTestCacic(QObject *parent) :
  7 + QObject(parent)
  8 +{
  9 +}
  10 +
  11 +void CTestCacic::installcacicTest()
  12 +{
  13 + QProcess installcacic;
  14 + QString installcacicPath;
  15 +
  16 + installcacicPath = "E:/Lightbase/cacic-projeto-test/build/cacic-test/debug/cacic-teste.exe";
  17 + installcacic.execute(installcacicPath,QStringList() << "--host:");
  18 + if (!installcacic.waitForFinished() and (installcacic.exitCode() == 5))
  19 + QVERIFY(installcacic.exitCode() == 5);
  20 + else
  21 + QSKIP("Installcacic ExitCode: " + QString::number(installcacic.exitCode()).toLocal8Bit());
  22 +
  23 +}
  24 +
  25 +void CTestCacic::firstTest()
  26 +{
  27 + QString str= "Hello";
  28 + QVERIFY(str.toUpper() == "HELLO");
  29 +}
  30 +
  31 +
  32 +
... ...
cacic-teste/testcacic.h 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +#ifndef TESTINSTALLCACIC_H
  2 +#define TESTINSTALLCACIC_H
  3 +
  4 +#include <QtTest/QtTest>
  5 +
  6 +class CTestCacic : public QObject
  7 +{
  8 + Q_OBJECT
  9 +public:
  10 + explicit CTestCacic(QObject *parent = 0);
  11 +
  12 +signals:
  13 +
  14 +public slots:
  15 +
  16 +private slots:
  17 + void firstTest();
  18 + void installcacicTest();
  19 +};
  20 +
  21 +#endif // TESTINSTALLCACIC_H
... ...
cacic-teste/testinstallcacic.cpp
... ... @@ -1,16 +0,0 @@
1   -#include "testinstallcacic.h"
2   -QTEST_MAIN(CTestInstallCacic)
3   -
4   -CTestInstallCacic::CTestInstallCacic(QObject *parent) :
5   - QObject(parent)
6   -{
7   -}
8   -
9   -void CTestInstallCacic::firstTest()
10   -{
11   - QString str= "Hello";
12   - QVERIFY(str.toUpper() == "HELLO");
13   -}
14   -
15   -
16   -
cacic-teste/testinstallcacic.h
... ... @@ -1,20 +0,0 @@
1   -#ifndef TESTINSTALLCACIC_H
2   -#define TESTINSTALLCACIC_H
3   -
4   -#include <QtTest/QtTest>
5   -
6   -class CTestInstallCacic : public QObject
7   -{
8   - Q_OBJECT
9   -public:
10   - explicit CTestInstallCacic(QObject *parent = 0);
11   -
12   -signals:
13   -
14   -public slots:
15   -
16   -private slots:
17   - void firstTest();
18   -};
19   -
20   -#endif // TESTINSTALLCACIC_H
install-cacic/main.cpp
1 1 #include <QCoreApplication>
  2 +#include <QStringList>
  3 +#include <iostream>
  4 +
  5 +using namespace std;
2 6  
3 7 int main(int argc, char *argv[])
4 8 {
5 9 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 + }
  21 + }
6 22  
7   - return a.exec();
  23 + return 1;
  24 +// return a.exec();
8 25 }
... ...