Mercurial > trustbridge
diff ui/tests/binverifytest.cpp @ 869:b1df9621c89c
Add a test for text signature creation with createinstallerdialog
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 05 Aug 2014 17:45:03 +0200 |
parents | 44fa5de02b52 |
children | 317ee9dc4684 |
line wrap: on
line diff
--- a/ui/tests/binverifytest.cpp Tue Aug 05 17:44:31 2014 +0200 +++ b/ui/tests/binverifytest.cpp Tue Aug 05 17:45:03 2014 +0200 @@ -7,8 +7,13 @@ */ #include "binverify.h" #include "binverifytest.h" +#include "createinstallerdialog.h" +#include "common.h" +#include "mainwindow.h" -#include <QTest> +#include <QtTest> +#include <QSettings> +#include <QTemporaryFile> #ifdef Q_OS_WIN # define EXE_SUFFIX ".exe" @@ -16,6 +21,12 @@ # define EXE_SUFFIX "" #endif +#ifdef Q_OS_WIN + Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) +#else + Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) +#endif + /* Some general robustness checks */ void BinVerifyTest::testMiscErrors() { @@ -71,4 +82,21 @@ strlen("fakeinst-signed" EXE_SUFFIX))); } -QTEST_GUILESS_MAIN (BinVerifyTest); +void BinVerifyTest::testSignatureCreation() +{ + QSettings testsettings; + testsettings.setValue("CodeSignCert", SOURCE_DIR"/data/codesign/codesigning-combined.pem"); + testsettings.sync(); + CreateInstallerDialog *theDialog = new CreateInstallerDialog(NULL); + QString garbage = getRandomDataFile(21*1024*1024); + QTemporaryFile outfile; + outfile.open(); + outfile.close(); + bool ret = theDialog->appendTextSignatureToFile (garbage, outfile.fileName()); + QVERIFY(QFile::remove(garbage)); + QVERIFY(ret == true); + QVERIFY(VerifyValid == verify_binary (outfile.fileName().toUtf8().constData(), + outfile.fileName().toUtf8().size())); +} + +QTEST_MAIN (BinVerifyTest);