Last change
on this file was 1144, checked in by Dmitry A. Kuminov, 12 years ago |
tests: Added a bunch of corelib tests.
|
File size:
1.2 KB
|
Line | |
---|
1 | #include <QtCore>
|
---|
2 | #include <QtGui>
|
---|
3 |
|
---|
4 | #include <QDebug>
|
---|
5 |
|
---|
6 | #include <stdlib.h>
|
---|
7 |
|
---|
8 | #define STR(expr) #expr
|
---|
9 | #define DBG(expr) STR(expr) << "=" << (expr)
|
---|
10 |
|
---|
11 | ////////////////////////////////////////////////////////////////////////////////
|
---|
12 |
|
---|
13 | bool testGSAvailability(const QString& gsPath)
|
---|
14 | {
|
---|
15 | qDebug() << DBG(gsPath);
|
---|
16 |
|
---|
17 | QStringList args;
|
---|
18 | args.append( "-h" );
|
---|
19 |
|
---|
20 | QProcess proc;
|
---|
21 | proc.start(gsPath, args);
|
---|
22 | if (!proc.waitForStarted(5000))
|
---|
23 | return false;
|
---|
24 |
|
---|
25 | proc.waitForFinished(5000);
|
---|
26 | return (proc.exitCode() == 0);
|
---|
27 | }
|
---|
28 |
|
---|
29 | class MyMessageBox : public QMessageBox
|
---|
30 | {
|
---|
31 | public:
|
---|
32 |
|
---|
33 | MyMessageBox() : QMessageBox (QMessageBox::Information, QLatin1String ("Title"), QLatin1String ("text")) {}
|
---|
34 |
|
---|
35 | virtual void contextMenuEvent (QContextMenuEvent *ev)
|
---|
36 | {
|
---|
37 | qDebug() << "Test QProcess";
|
---|
38 | bool result = testGSAvailability (QLatin1String ("c:/gs/gs8.71/bin/gsos2.exe"));
|
---|
39 | qDebug() << DBG(result);
|
---|
40 | }
|
---|
41 | };
|
---|
42 |
|
---|
43 | int main(int argc, char *argv[])
|
---|
44 | {
|
---|
45 | QApplication app (argc, argv);
|
---|
46 |
|
---|
47 | MyMessageBox mbox;
|
---|
48 | mbox.show();
|
---|
49 |
|
---|
50 | app.exec();
|
---|
51 |
|
---|
52 | // bool result = testGSAvailability (QLatin1String ("c:/gs/gs8.71/bin/gsos2.exe"));
|
---|
53 | // qDebug() << DBG(result);
|
---|
54 |
|
---|
55 | return 0;
|
---|
56 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.