qttset

#sudo apt-get install qt4-dev-tools qt4-demos qt4-doc qt4-qmake
#./assistant-qt4


//add qtestlib to project.pro
CONFIG  += qtestlib


#ls /usr/lib/qt4/examples/qtestlib
#cp /usr/lib/qt4/examples/qtestlib ~/qttest
#cd ~/qttest/tutorial1
#ls
testqstring.cpp  tutorial1.pro
// compile example
#qmake
#make
#./tutorial1 
********* Start testing of TestQString *********
Config: Using QTest library 4.8.1, Qt 4.8.1
PASS   : TestQString::initTestCase()
PASS   : TestQString::toUpper()
PASS   : TestQString::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of TestQString *********
---------------------------
In tutorial1/testqstring.cpp
//! [0]
#include <QtTest/QtTest>
class TestQString: public QObject
{
    Q_OBJECT
private slots:
    void toUpper();
};
//! [0]


//! [1]
void TestQString::toUpper()
{
    QString str = "Hello";
    QCOMPARE(str.toUpper(), QString("HELLO"));
}
//! [1]


//! [2]
QTEST_MAIN(TestQString)
#include "testqstring.moc"
//! [2]
-------------------------------------
In tutorial2/testqstring.cpp
#include <QtTest/QtTest>


//! [0]
class TestQString: public QObject
{
    Q_OBJECT


private slots:
    void toUpper_data();
    void toUpper();
};
//! [0]


//! [1]
void TestQString::toUpper_data()
{
    QTest::addColumn<QString>("string");
    QTest::addColumn<QString>("result");


    QTest::newRow("all lower") << "hello" << "HELLO";
    QTest::newRow("mixed")     << "Hello" << "HELLO";
    QTest::newRow("all upper") << "HELLO" << "HELLO";
}
//! [1]


//! [2]
void TestQString::toUpper()
{
    QFETCH(QString, string);
    QFETCH(QString, result);


    QCOMPARE(string.toUpper(), result);
}
//! [2]


//! [3]
QTEST_MAIN(TestQString)
#include "testqstring.moc"
//! [3]
------------------------
In tutorial3/testgui.cpp
//! [0]
#include <QtGui>
#include <QtTest/QtTest>


class TestGui: public QObject
{
    Q_OBJECT


private slots:
    void testGui();


};
//! [0]


//! [1]
void TestGui::testGui()
{
    QLineEdit lineEdit;


    QTest::keyClicks(&lineEdit, "hello world");


    QCOMPARE(lineEdit.text(), QString("hello world"));
}
//! [1]


//! [2]
QTEST_MAIN(TestGui)
#include "testgui.moc"
//! [2]
----------------------------
In tutorial4/testgui.cpp
#include <QtGui>
#include <QtTest/QtTest>


//! [0]
class TestGui: public QObject
{
    Q_OBJECT


private slots:
    void testGui_data();
    void testGui();
};
//! [0]


//! [1]
void TestGui::testGui_data()
{
    QTest::addColumn<QTestEventList>("events");
    QTest::addColumn<QString>("expected");


    QTestEventList list1;
    list1.addKeyClick('a');
    QTest::newRow("char") << list1 << "a";


    QTestEventList list2;
    list2.addKeyClick('a');
    list2.addKeyClick(Qt::Key_Backspace);
    QTest::newRow("there and back again") << list2 << "";
}
//! [1]


//! [2]
void TestGui::testGui()
{
    QFETCH(QTestEventList, events);
    QFETCH(QString, expected);


    QLineEdit lineEdit;


    events.simulate(&lineEdit);


    QCOMPARE(lineEdit.text(), expected);
}
//! [2]


//! [3]
QTEST_MAIN(TestGui)
#include "testgui.moc"
//! [3]
---------------------------------------
#include <QtGui>
#include <qtest.h>


class TestBenchmark : public QObject
{
    Q_OBJECT
private slots:
    void simple();
    void multiple_data();
    void multiple();
    void series_data();
    void series();
};


//! [0]
void TestBenchmark::simple()
{
    QString str1 = QLatin1String("This is a test string");
    QString str2 = QLatin1String("This is a test string");


    QCOMPARE(str1.localeAwareCompare(str2), 0);


    QBENCHMARK {
        str1.localeAwareCompare(str2);
    }
}
//! [0]


//! [1]
void TestBenchmark::multiple_data()
{
    QTest::addColumn<bool>("useLocaleCompare");
    QTest::newRow("locale aware compare") << true;
    QTest::newRow("standard compare") << false;
}
//! [1]


//! [2]
void TestBenchmark::multiple()
{
    QFETCH(bool, useLocaleCompare);
    QString str1 = QLatin1String("This is a test string");
    QString str2 = QLatin1String("This is a test string");
    
    int result;
    if (useLocaleCompare) {
        QBENCHMARK {
            result = str1.localeAwareCompare(str2);
        }
    } else {
        QBENCHMARK {
            result = (str1 == str2);
        }
    }
}
//! [2]


//! [3]
void TestBenchmark::series_data()
{
    QTest::addColumn<bool>("useLocaleCompare");
    QTest::addColumn<int>("stringSize");
    
    for (int i = 1; i < 10000; i += 2000) {
        QByteArray size = QByteArray::number(i);
        QTest::newRow(("locale aware compare--" + size).constData()) << true << i;
        QTest::newRow(("standard compare--" + size).constData()) << false << i;
    }
}
//! [4]


//! [5]
void TestBenchmark::series()
{
    QFETCH(bool, useLocaleCompare);
    QFETCH(int, stringSize);


    QString str1 = QString().fill('A', stringSize);
    QString str2 = QString().fill('A', stringSize);
    int result;
    if (useLocaleCompare) {
        QBENCHMARK {
            result = str1.localeAwareCompare(str2);
        }
    } else {
        QBENCHMARK {
            result = (str1 == str2);
        }
    }
}
//! [5]


QTEST_MAIN(TestBenchmark)
#include "benchmarking.moc"
---------------------------------------
./tutorial4 --help
 Usage: ./tutorial4 [options] [testfunction[:testdata]]...
    By default, all testfunctions will be run.


 options:
 -functions : Returns a list of current testfunctions
 -datatags  : Returns a list of current data tags.
              A global data tag is preceded by ' __global__ '.
 -xunitxml  : Outputs results as XML XUnit document
 -xml       : Outputs results as XML document
 -lightxml  : Outputs results as stream of XML tags
 -flush     : Flushes the results
 -o filename: Writes all output into a file
 -silent    : Only outputs warnings and failures
 -v1        : Print enter messages for each testfunction
 -v2        : Also print out each QVERIFY/QCOMPARE/QTEST
 -vs        : Print every signal emitted
 -random    : Run testcases within each test in random order
 -seed n    : Positive integer to be used as seed for -random. If not specified,
              the current time will be used as seed.
 -eventdelay ms    : Set default delay for mouse and keyboard simulation to ms milliseconds
 -keydelay ms      : Set default delay for keyboard simulation to ms milliseconds
 -mousedelay ms    : Set default delay for mouse simulation to ms milliseconds
 -keyevent-verbose : Turn on verbose messages for keyboard simulation
 -maxwarnings n    : Sets the maximum amount of messages to output.
                     0 means unlimited, default: 2000
 -nocrashhandler   : Disables the crash handler


 Benchmark related options:
 -callgrind      : Use callgrind to time benchmarks
 -tickcounter    : Use CPU tick counters to time benchmarks
 -eventcounter   : Counts events received during benchmarks
 -minimumvalue n : Sets the minimum acceptable measurement value
 -iterations  n  : Sets the number of accumulation iterations.
 -median  n      : Sets the number of median iterations.
 -vb             : Print out verbose benchmarking information.


 -help      : This help


--------------------------------
valgrind
gdb
下载前必看:https://pan.quark.cn/s/a4b39357ea24 在当前快节奏的社会背景下,快递代拿服务已演变为日常生活中不可或缺的组成部分。 基于SSM(Spring、SpringMVC、MyBatis)框架的Java快递代拿系统,正是为了迎合这一需求而进行设计和构建的。 接下来将系统性地阐述系统的功能特性、架构布局以及具体的实现步骤。 1. **系统功能**: - **用户模块**:用户具备注册账户、登录验证、提交订单、挑选快递代取服务以及完成线上支付的各项操作。 - **订单模块**:当客户提交订单后,系统将自动生成包含快递种类、取件地点、送件地点等详细信息的订单记录,用户能够实时追踪订单进展,如待接单、处理中、已完成等不同阶段。 - **管理员模块**:管理员享有高级操作权限,能够接收并处理订单,执行订单的添加、删除、查询和修改等操作,同时负责处理用户的疑问和投诉。 - **支付模块**:系统整合了在线支付接口,支持用户通过第三方支付渠道完成支付,以此保障交易过程的安全性和便利性。 2. **技术选型**: - **SSM框架**:Spring主要用于依赖注入和事务控制,SpringMVC负责处理客户端请求与服务器响应,MyBatis作为数据持久化层,执行数据库交互,三者协同工作构建了一个高效且灵活的开发环境。 - **MySQL数据库**:系统内所有数据,包括用户资料、订单详情、支付历史等,均存储于MySQL数据库中,其卓越的查询性能和稳定性为系统提供了可靠的数据基础。 3. **系统架构**: - **前端**:运用HTML、CSS和JavaScript进行界面设计,可能还会引入Vue.js或jQuery等库以增强用户体验。 - **后端*...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值