<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] ## 模擬GUI事件 QTestLib發送內部Qt事件,而不是模擬本地窗口系統事件,因此運行測試程序不會對機器產生任何副作用 測試文件: 與數據測試不同,需要引入 `QtGuid` ``` #include <QtGui> #include <QtTest/QtTest> class TestGui: public QObject { Q_OBJECT private slots: void testGui(); }; void TestGui::testGui() { QLineEdit lineEdit; // 模擬按鍵,輸入 hello word,可以指定延遲時間 QTest::keyClicks(&lineEdit, "hello world"); QCOMPARE(lineEdit.text(), QString("hello world")); } ``` ## 批量測試 ``` class TestGui: public QObject { Q_OBJECT private slots: void testGui_data(); void testGui(); }; ... void TestGui::testGui_data() { QTest::addColumn<QTestEventList>("events"); QTest::addColumn<QString>("expected"); QTestEventList list1; list1.addKeyClick('a'); QTest::newRow("char") << list1 << "a"; // 先點擊a,在點擊backspace QTestEventList list2; list2.addKeyClick('a'); list2.addKeyClick(Qt::Key_Backspace); QTest::newRow("there and back again") << list2 << ""; } ... void TestGui::testGui() { QFETCH(QTestEventList, events); QFETCH(QString, expected); QLineEdit lineEdit; // 在控件上觸發事件隊列 events.simulate(&lineEdit); QCOMPARE(lineEdit.text(), expected); } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看