Results 1 to 4 of 4

Thread: How to install my own application in QUnitTest

  1. #1
    Join Date
    Jan 2006
    Location
    Germany, Rostock
    Posts
    17
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question How to install my own application in QUnitTest

    Hi,

    I need to create an application instance (which is derived from QApplication) in a QUnitTest. This application instace require argc/argv as given in main().

    All single test steps of the QUnitTest will use this application instance.

    Are there any ideas how to arrange that?

    Thanks Artschi

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to install my own application in QUnitTest

    What is QUnitTest? Why do you want to subclass QApplication? QApplication already has support for argc and argv...

  3. #3
    Join Date
    Jan 2006
    Location
    Germany, Rostock
    Posts
    17
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to install my own application in QUnitTest

    QUnitTest is the Qt's UnitTest framework, right? And it is definitly not my problem, if it is a good decission to subclass QApplication. That is given to me.

    To be more precise:

    There is a
    class XApplication : public QApplication
    that has to be instantiated at the very beginning of main() in the same way as a QApplication instance has to be created:

    main(int argc, char *argv[]) {
    Xapplication appl(argc, argv);
    // ...
    }

    In the Qt UnitTest framework the main() is not accessable and the question is:
    How to create an XAppliation instance in the Qt UnitTest application.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to install my own application in QUnitTest

    Quote Originally Posted by Artschi
    QUnitTest is the Qt's UnitTest framework, right?
    You mean QTestLib?

    In the Qt UnitTest framework the main() is not accessable and the question is:
    How to create an XAppliation instance in the Qt UnitTest application.
    This is not true. You may skip using QTEST_MAIN() macro and implement your own main(). The macro is only for convenience. It is defined as:

    Qt Code:
    1. #define QTEST_MAIN(TestObject) \
    2. int main(int argc, char *argv[]) \
    3. { \
    4. QApplication app(argc, argv); \
    5. TestObject tc; \
    6. return QTest::qExec(&tc, argc, argv); \
    7. }
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to wysota for this useful post:

    Artschi (25th July 2006)

Similar Threads

  1. Replies: 3
    Last Post: 8th December 2006, 18:51
  2. Mac OSX install Tiger intel&ppc qmake
    By patrik08 in forum Installation and Deployment
    Replies: 3
    Last Post: 6th July 2006, 18:54
  3. Replies: 3
    Last Post: 31st March 2006, 18:38
  4. Replies: 0
    Last Post: 21st February 2006, 16:30
  5. Cannot Install KDEdevel packages on linux
    By wirajr in forum KDE Forum
    Replies: 12
    Last Post: 5th February 2006, 21:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.