Self-turning blog: http://blog.csdn.net/zhu_xz/archive/2009/12/25/5076157.aspx
The qtestlib framework provides an easy-to-use unit test framework. You need to add QT ++ = testlib to the project file. First read oneSimple Example:
C/C ++ code
# Include
Class testqstring: Public qobject
{
Q_object
Private slots:
// Each private slot function is a test function automatically called.
Void testtolower ();
// The function ending with "_ DATA" provides test data to the corresponding test function.
Voi
compilers, it is consistent with the Microsoft ABI under Windows, and in other platforms, with GCC.Use examples to speakWhat's an example? The amount ... Find a simple dynamic library and see the name of the function it derives from. QT's core and GUI modules are too complex, take the QT test module to see it, QtTest4.dll or libqttest.so.4.8.0How do you see the symbols?
Under Windows, we can use the DUMPBIN tool:
Dumpbin/exports Qttest4.dll
On Linux, we can use NM or read
Why does QT not provide sleep?
Someone asked me from time to time on the Forum:
Why does QT not provide cross-platform sleep functions?
Why didn't the interface respond after using platform-related sleep or nanosleep?
Qthread provides the sleep function with the protected permission. How do I use it in the main thread?
How can I hide the console in Windows by using qsleep in qtest?
These problems actually come down to one point: using these func
; setvalue (I + 1); // Note: Here is I + 1, not I, so that 100% is displayed54. qtest: qsleep (100 );55}56}57 else if (typecombobox-> currentindex () = 1)58 {59 qprogressdialog * progressdialog = new qprogressdialog (this );60 qfont font ("Times", 10, qfont: bold );61 progressdialog-> setfont (font );62 progressdialog-> setwindowmodality (QT: windowmodal); // set the window mode. After the copy dialog box is displayed, the parent window cannot be oper
class, write a testqstring. cpp file.
#include
Then, enable the testlib module in the Pro file. The others are the same as the common QT program.
When cmake is used, we divide it into two files
//testqstring.h #include
And
//testqstring.cpp void TestQString::toUpper() { QString str = "Hello"; QCOMPARE(str.toUpper(), QString("HELLO")); } QTEST_MAIN(TestQString) #include "testqstring.moc"
Then the processing method is the macro we saw earlier.Qtest macro
Take a look at the
PatchesWe think of old-prj.tar.bz2 as the Linux kernel, and when we unzip it, we go to the root folder of the code tree:$ mkdir qtest; CD qtest; Tar xvjf. /old-prj.tar.bz2; MV Old-prj PRJ; CD PRJWe usually have to make an official patch before we change the code. In quilt, the ability to import patches with the import command:$ Quilt Import: /.. /prj.diffImporting Patch: /.. /prj.diff (stored as Prj.diff)A
process strategy.2.2 import Patches
We think of the old-prj.tar.bz2 as the Linux kernel, We decompress it and enter the root directory of the code tree:
$ Mkdir qtest; CD qtest; tar xvjf ../old-prj.tar.bz2; MV old-prj; CD prj
Before modifying the code, we usually need to install official patches first. In quilt, you can use the import command to import the patch:
$ Quilt import.../prj. Diff
Importing patch
. showmessage (qobject: TR ("loading module data .... "), QT: alignleft | QT: alignbottom, QT: Green); // after the program data is loaded, display the main view and end the startup screen W. show (); splash. finish ( W); Return a.exe C ();}
If you want to customize the time when the startup screen exists, you can use the qtime or qelapsedtimer class to implement program waiting. As shown in the following figure, the program loops for 1 s in an empty loop:
Qelapsedtimer t; T. Start (); Wh
-prj.tar.bz2 as the Linux kernel, and when we unzip it, we go to the root folder of the code tree:$ mkdir qtest; CD qtest; Tar xvjf. /old-prj.tar.bz2; MV Old-prj PRJ; CD PRJWe usually have to make an official patch before we change the code. In quilt, the ability to import patches with the import command:$ Quilt Import: /.. /prj.diffImporting Patch: /.. /prj.diff (stored as Prj.diff)After running the Improt
polymorphic. That is, polymorphism is the same message that makes different classes respond differently.There are three prerequisites for implementing polymorphism in Java: inheritance, rewriting, and upward transformation.Inheritance: Subclasses and parent classes that have inheritance relationships must exist in polymorphism.Rewrite: Subclasses redefine some methods in the parent class and call the methods of the subclasses when they are called.Upward transformation: In polymorphic, a referen
Using the sleep function in QT is difficult. This function is not available in several common header files. There is a sleep in the QTest class for unit testing. You can run the following command:
# IncludeQTest>
.......
QTest ::QSleep(100);
In this way. In the help document, qSleep actually calls the sleep function provided by the operating system. For example, it calls nanosleep () on Linux and Sleep
PatchesWe think of old-prj.tar.bz2 as the Linux kernel, and when we unzip it, we go to the root folder of the code tree:$ mkdir qtest; CD qtest; Tar xvjf. /old-prj.tar.bz2; MV Old-prj PRJ; CD PRJWe usually have to make an official patch before we change the code. In quilt, the ability to import patches with the import command:$ Quilt Import: /.. /prj.diffImporting Patch: /.. /prj.diff (stored as Prj.diff)A
PatchesWe think of old-prj.tar.bz2 as the Linux kernel, and when we unzip it, we go to the root folder of the code tree:$ mkdir qtest; CD qtest; Tar xvjf. /old-prj.tar.bz2; MV Old-prj PRJ; CD PRJWe usually have to make an official patch before we change the code. In quilt, the ability to import patches with the import command:$ Quilt Import: /.. /prj.diffImporting Patch: /.. /prj.diff (stored as Prj.diff)A
192.168.40.128:7000 to check the status of the cluster
Performance testing
Bring your own test tool Redis-benchmark
redis-benchmark -h 192.168.40.128 -p 6379 -c 100 -n 100000100 concurrent connections, 100,000 requests, detects Redis server performance with host localhost port 6379.
redis-benchmark -h 192.168.40.128 -p 6379 -q -d 100Test the performance of a packet that accesses a size of 100 bytes.
redis-benchmark -t set,lpush -n 100000 -qT
provided by IBM engineers is very simple, but there are key Annotations:
Mqenvironment. ccsid = 1381; // same as the queue managerMqenvironment. hostname = "localhost"; // name of the machine where the queue manager is located, which must be pingedMqenvironment. Port = 1414; // listening port of the queue managerMqenvironment. Channel = "chtest ";Mqqueuemanager qmgr = new mqqueuemanager ("testqm"); // Queue Manager nameMqqueue queue = qmgr. accessqueue ("qt
want to perform killall securely, you can use the-q option:
___FCKpd___8nbsp;killall-qTEST
___FCKpd___8nbsp;
As you can see, after the-q option is used, the output information of the killall command is blocked.
5. use the-l option to list all supported signals (signal)
As described earlier, killall sends signals to processes.
You can use the-s option (followed by a signal name) to send a special signal to a process.
To know all the signals t
.
$killalltesttest_again
[2]-Terminated./test_again
[3]+Terminated./test
However, if you want killall to terminate the process interactively, you can use the-I option.
Here is an example:
$killall-itesttest_again
Killtest(4201)?(y/N)y
Killtest_again(4202)?(y/N)y
[1]-Terminated./test
[2]+Terminated./test_again
You can see that, in this way, when terminating multiple processes at the same time, the user can control whether to terminate a process.
4. Use the-q option to di
UITableView including using your Uitableviewdatasource and uitableviewdelegate.I want to say almost all iOS apps use the table view.Let's say you've used Qwebview, and UIWebView is the same.Qimage and Qpixmap equate to cgdataproviderref,nsimage and cgimage.You can use the core graphics method to define your own drawing. Uigraphicsbeginimagecontextwithoptions creates a context in which you can use the paint feature. Suppose you want to get the context of the bitmap, try Uigraphicsgetimagefromcur
Qt5 Addin There is a problem VS2013 install QT5 plug-in, the following problem: Qt5Widgetsd.lib (Qt5Widgetsd.dll): Fatal error LNK1112: module machine Type "x64" and target computer type " X86 "conflict" 1 "Set Qt Options", add the following information variable name: VS2013_QT path: F:\Qt\Qt5.3.0\5.3\msvc2013_64_opengl (QT5 installation directory) "2" right click on the Qtest project, select "PROPERTIES---Linker--Advanced---target computer, change th
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.