Does Qt testing framework support comparing list of pointers or I am doing something wrong?
My unit test source is as follows:
QList list1;
QList list2;
list1.append(new QString("test"));
list2.append(new…
I have a pop-up menu in a QTableWidget (resultTable). In the constructor of my class I set the context menu policy:
resultTable->setContextMenuPolicy(Qt::CustomContextMenu);
connect(resultTable, SIGNAL(customContextMenuRequested(QPoint)), this,…
I'm trying to create tests for a c++ application with QtTest. The three relevent files that I have are: GuiTests.cpp which contains my main function, testsuite1.cpp which contains my tests and testsuite1.h which contains the definitions of my tests.…
I have a class with following constructor: MyClass(QFile& file);. I want to unit-test it with Qt Test framework. How do I specify content of the file from a unit-test (without actually creating a real file)?
When searching through Qt files to for all the different Qt Test results, I came across BPASS and BFAIL. I'd like to write some passing/failing tests. The problem is, I can't find any examples of people writing tests that generate these results, and…
I am currently testing a Qt application. I have to build a test to check the correct input and output of csv files.
Problem:
The data is being read asynchronously and my test program is ending before the data is loaded and this is the output i…
I am simulating F1 key using QTest::keyPress() method to test keypress event, on simulation of F1 key when i check for nativeScanCode, it returns 0 value. can any one help?
//Code snippet
//To simulate F1 key press
QTest::keyPress(&kboard,…
I am trying to create a "Qt unit test" following this tutorial. I created a new project: Qt Gui Application with a header file as mentioned and a class that contains the test function. I added #CONFIG += testlib to my ".pro" file. However, when I…
I have a QtTest that is comparing two string values:
// This definitely returns "5/6"
std::string actual_value = simple(actual);
// Sets a string to the expected value
std::string expected_value = "5/6";
and then a…
I want to do unit testing for some simple exercises i have done in c++ using Qt. i figured using QtTest seemed like a reasonable place to start.
i have a class that returns an integer and i want to test that the expected result is the same as the…
I need to make some unit test for my school project in Qt and although I have read Qt tutorial on that I can't figure out how am I supposed to write such tests. All of tests shown in tutorial I've mentioned refer to built-in methods. How should I…
I am trying to simulate user input to close a window. I try to use QTest::keyClick(Qt::key::Key_F4, myWidget, Qt::KeyboardModifiers{ Qt::KeyboardModifier::AltModifier }); to simulate the user clicking the Alt+F4 keyboard combo, but it does not…
I'm seeing an issue in my QML animation, where very rarely, a state transition animation does not happen. I was searching online why that might be and came across SignalSpy. How and when should someone use it? The example is confusing, I thought it…
I run an exe that benchmarks C++ code on my Windows Embedded Compact (WEC2013) i.MX6 platform over telnet. Results go to the serial port and I cannot redirect them to a file, which would be ideal.
My benchmark uses QBENCHMARK and works as expected…
Is it possible to perform benchmarking with QBENCHMARK with a different data point each time a measurement is made? To be more specific, I have the following test case:
void TestImage::test_IMCreationBenchmark_data()
{
const uint HEIGHT = 480;
…