qtestlib

How to structure project while unit-testing Qt app by QTestLib

╄→гoц情女王★ 提交于 2019-12-03 02:42:22
问题 I got my Qt project and I'm using Qt Creator. I want to unit-test all my code. However I'm quite new at QTestLib framework but everyone recommended it for testing Qt-based source. Now I'm a little confused how to structure test project with app project. Can I put all source and testing code in same project? If so, how could I manage them? I didn't find any option that let me start app or start test in one project. If I put app source and testing code in separate projects, the testing project

How to structure project while unit-testing Qt app by QTestLib

社会主义新天地 提交于 2019-12-02 16:12:56
I got my Qt project and I'm using Qt Creator. I want to unit-test all my code. However I'm quite new at QTestLib framework but everyone recommended it for testing Qt-based source. Now I'm a little confused how to structure test project with app project. Can I put all source and testing code in same project? If so, how could I manage them? I didn't find any option that let me start app or start test in one project. If I put app source and testing code in separate projects, the testing project will reference app project, that's not quite convenient. For lots for classes required to be tested,

QTest mouseClick on a QPushButton

随声附和 提交于 2019-12-01 13:45:02
i tried to click a QPushButton with the mouseClick function of the QTest namespace. The QPushButton is a private Member of an Widget. The position of the mouse cursor during the click is in the center of the button, but the Button is not clicked... Can somebady explain me why? MyWidget *myWidget= new myWidget(); myWidget->show(); while ( !myWidget->isVisible() ) { QTest::qWait(200); } QTest::qWait(500); QTest::mouseMove ( myWidget, QPoint( 70, 100 ), -1 ); QTest::mouseClick ( myWidget, Qt::LeftButton, Qt::NoModifier, QPoint( 70, 100 ), 100); Thanks Make the comment to be the answer. The

QT : get the class name of an object

亡梦爱人 提交于 2019-11-30 06:02:07
I'm writing a test app that simulates key presses of another application. For every key press I have to check if the right window/form is shown. So what I do is get the pointer of the window being shown and get it's window title. However, not all the windows/forms shown window titles. So I'm thinking it would be better to get the name of the class instead. How can I get the name of the class? QWidget *pWin = QApplication::activeWindow(); when I try: pWin->className(); to get the name of the class, I'm getting: "error: class QWidget has no member named 'className' " Can somebody show me the

How to compose all QtTestLib unit tests' results in a single file while using a single test project?

耗尽温柔 提交于 2019-11-29 14:50:07
问题 In our project we are using the QtTestLib for a unit testing. The reasons are that the whole project already uses Qt whenever it's possible and it's a GUI application, so we wanted to have ability for testing GUI interfaces. Our project is compiled by the MSVC, so we didn't want to have a separated project file for each test 'coz it will clutter the solution. Thus we have created a single project for all tests. All testing should be automated on a CIS (continuous integration), so we tried to

QT : get the class name of an object

北城余情 提交于 2019-11-29 01:47:05
问题 I'm writing a test app that simulates key presses of another application. For every key press I have to check if the right window/form is shown. So what I do is get the pointer of the window being shown and get it's window title. However, not all the windows/forms shown window titles. So I'm thinking it would be better to get the name of the class instead. How can I get the name of the class? QWidget *pWin = QApplication::activeWindow(); when I try: pWin->className(); to get the name of the

What unit-testing framework should I use for Qt? [closed]

独自空忆成欢 提交于 2019-11-28 15:35:18
I am just starting up a new project that needs some cross-platform GUI, and we have chosen Qt as the GUI-framework. We need a unit-testing framework, too. Until about a year ago we used an in-house developed unit-testing framework for C++-projects, but we are now transitioning to using Google Test for new projects. Does anyone have any experience with using Google Test for Qt-applications? Is QtTest/QTestLib a better alternative? I am still not sure how much we want to use Qt in the non-GUI parts of the project - we would probably prefer to just use STL/Boost in the core-code with a small

What unit-testing framework should I use for Qt? [closed]

杀马特。学长 韩版系。学妹 提交于 2019-11-27 09:17:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I am just starting up a new project that needs some cross-platform GUI, and we have chosen Qt as the GUI-framework. We need a unit-testing framework, too. Until about a year ago we used an in-house developed unit-testing framework for C++-projects, but we are now transitioning to using Google Test for new