feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试 2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程 3.重整权利声明文件,重整代码工程,确保最小化侵权风险 Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
This commit is contained in:
@ -1,265 +0,0 @@
|
||||
/*
|
||||
|
||||
* Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd.
|
||||
|
||||
*
|
||||
|
||||
* Author: wangcong <wangcong@uniontech.com>
|
||||
|
||||
*
|
||||
|
||||
* Maintainer: wangcong <wangcong@uniontech.com>
|
||||
|
||||
*
|
||||
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
|
||||
* any later version.
|
||||
|
||||
*
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
#include "../../src/tessocrutils/tessocrutils.h"
|
||||
#include "stub.h"
|
||||
#include "addr_pri.h"
|
||||
#include <QDir>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
class TessOcrUtilsTest:public testing::Test{
|
||||
|
||||
public:
|
||||
Stub stub;
|
||||
QString testImgPath = "/Wallpapers/marian-kroell-qElMHWePpok-unsplash.jpg";
|
||||
TessOcrUtils *m_tessOCrUtils = nullptr;
|
||||
virtual void SetUp() override{
|
||||
m_tessOCrUtils = TessOcrUtils::instance();
|
||||
std::cout << "start TessOcrUtilsTest" << std::endl;
|
||||
}
|
||||
|
||||
virtual void TearDown() override{
|
||||
std::cout << "end TessOcrUtilsTest" << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
ACCESS_PRIVATE_FUN(TessOcrUtils, bool(const QString), setLanguagesPath);
|
||||
ACCESS_PRIVATE_FUN(TessOcrUtils, bool(ResultType), isExistsResultType);
|
||||
ACCESS_PRIVATE_FUN(TessOcrUtils, QString(Languages), getLangStr);
|
||||
ACCESS_PRIVATE_FUN(TessOcrUtils, Languages(), getSystemLang);
|
||||
ACCESS_PRIVATE_FUN(TessOcrUtils, QString(), getLanguages);
|
||||
ACCESS_PRIVATE_FUN(TessOcrUtils, RecognitionResult(Pix*, ResultType), getRecognizeResult);
|
||||
ACCESS_PRIVATE_FUN(TessOcrUtils, void(ErrorCode, const QString,const ResultType,RecognitionResult &), setResult);
|
||||
|
||||
|
||||
|
||||
TEST_F(TessOcrUtilsTest, tessOcrUtils)
|
||||
{
|
||||
EXPECT_NE(nullptr, m_tessOCrUtils);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(TessOcrUtilsTest, getRecogitionResultImagePathAndResultType)
|
||||
{
|
||||
//QString imagePath = "/media/wangcong/workspace/wangcong/workspace/qt_workspace/project/deepin-ocr/assets/testocr.png";
|
||||
QString imagePath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + testImgPath;
|
||||
ResultType resultType = ResultType::RESULT_STRING;
|
||||
RecognitionResult recognitionResult = m_tessOCrUtils->getRecogitionResult(imagePath,resultType);
|
||||
EXPECT_EQ(true, recognitionResult.flag);
|
||||
EXPECT_EQ("", recognitionResult.message);
|
||||
EXPECT_EQ(ErrorCode::OK, recognitionResult.errorCode);
|
||||
EXPECT_EQ(resultType, recognitionResult.resultType);
|
||||
//EXPECT_NE("", recognitionResult.result);
|
||||
}
|
||||
|
||||
TEST_F(TessOcrUtilsTest, getRecogitionResult2ImagePath)
|
||||
{
|
||||
QString imagePath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + testImgPath;
|
||||
RecognitionResult recognitionResult = m_tessOCrUtils->getRecogitionResult(imagePath);
|
||||
recognitionResult = m_tessOCrUtils->getRecogitionResult(imagePath);
|
||||
EXPECT_EQ(true, recognitionResult.flag);
|
||||
EXPECT_EQ("", recognitionResult.message);
|
||||
EXPECT_EQ(ErrorCode::OK, recognitionResult.errorCode);
|
||||
EXPECT_EQ(ResultType::RESULT_STRING, recognitionResult.resultType);
|
||||
//EXPECT_NE("", recognitionResult.result);
|
||||
}
|
||||
|
||||
TEST_F(TessOcrUtilsTest, getRecogitionResultImageAndResultType)
|
||||
{
|
||||
QString imagePath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + testImgPath;
|
||||
ResultType resultType = ResultType::RESULT_STRING;
|
||||
QImage* t_image = new QImage(imagePath);
|
||||
RecognitionResult recognitionResult = TessOcrUtils::instance()->getRecogitionResult(t_image,resultType);
|
||||
EXPECT_EQ(true, recognitionResult.flag);
|
||||
EXPECT_EQ("", recognitionResult.message);
|
||||
EXPECT_EQ(ErrorCode::OK, recognitionResult.errorCode);
|
||||
EXPECT_EQ(resultType, recognitionResult.resultType);
|
||||
delete t_image;
|
||||
//EXPECT_NE("", recognitionResult.result);
|
||||
}
|
||||
|
||||
TEST_F(TessOcrUtilsTest, getRecogitionResultImage)
|
||||
{
|
||||
QString imagePath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + testImgPath;
|
||||
QImage* t_image = new QImage(imagePath);
|
||||
RecognitionResult recognitionResult = TessOcrUtils::instance()->getRecogitionResult(t_image);
|
||||
EXPECT_EQ(true, recognitionResult.flag);
|
||||
EXPECT_EQ("", recognitionResult.message);
|
||||
EXPECT_EQ(ErrorCode::OK, recognitionResult.errorCode);
|
||||
EXPECT_EQ(ResultType::RESULT_STRING, recognitionResult.resultType);
|
||||
delete t_image;
|
||||
//EXPECT_NE("", recognitionResult.result);
|
||||
|
||||
}
|
||||
TEST_F(TessOcrUtilsTest, getRecogitionResultImageError)
|
||||
{
|
||||
QString imagePath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||||
QString path = "";
|
||||
RecognitionResult recognitionResult = TessOcrUtils::instance()->getRecogitionResult(path);
|
||||
EXPECT_EQ(ErrorCode::OCR_P_NULL, recognitionResult.errorCode);
|
||||
recognitionResult = TessOcrUtils::instance()->getRecogitionResult(imagePath);
|
||||
EXPECT_EQ(ErrorCode::OCR_P_NULL, recognitionResult.errorCode);
|
||||
|
||||
QImage* p_image = new QImage;
|
||||
recognitionResult = TessOcrUtils::instance()->getRecogitionResult(p_image);
|
||||
EXPECT_EQ(ErrorCode::OCR_P_NULL, recognitionResult.errorCode);
|
||||
delete p_image;
|
||||
|
||||
}
|
||||
TEST_F(TessOcrUtilsTest, isRunning)
|
||||
{
|
||||
EXPECT_EQ(false, m_tessOCrUtils->isRunning());
|
||||
QString imagePath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + testImgPath;
|
||||
ResultType resultType = ResultType::RESULT_STRING;
|
||||
RecognitionResult recognitionResult = m_tessOCrUtils->getRecogitionResult(imagePath,resultType);
|
||||
EXPECT_EQ(false, m_tessOCrUtils->isRunning());
|
||||
}
|
||||
|
||||
TEST_F(TessOcrUtilsTest, getRecognizeResult)
|
||||
{
|
||||
QString imagePath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + testImgPath;
|
||||
QImage* image = new QImage(imagePath);
|
||||
ResultType resultType = ResultType::RESULT_STRING;
|
||||
Pix *p_image;
|
||||
p_image = pixCreate(image->width(), image->height(), image->depth());
|
||||
p_image->w = static_cast<l_uint32>(image->width());
|
||||
p_image->h = static_cast<l_uint32>(image->height());
|
||||
p_image->d = static_cast<l_uint32>(image->depth());
|
||||
p_image->spp = 3;
|
||||
p_image->wpl = static_cast<l_uint32>(image->width());
|
||||
p_image->refcount = 1;
|
||||
p_image->xres = 0;
|
||||
p_image->yres = 0;
|
||||
p_image->informat = 0;
|
||||
p_image->special = 0;
|
||||
p_image->text = nullptr;
|
||||
p_image->colormap = nullptr;
|
||||
//p_image->data = reinterpret_cast<l_uint32*>(image->bits());
|
||||
memcpy(reinterpret_cast<void*>(pixGetData(p_image)), reinterpret_cast<void*>(image->bits()), p_image->wpl * p_image->h * 4);
|
||||
|
||||
call_private_fun::TessOcrUtilsgetRecognizeResult(*m_tessOCrUtils,p_image,ResultType::UNKNOWN_TYPE);
|
||||
RecognitionResult recognitionResult = call_private_fun::TessOcrUtilsgetRecognizeResult(*m_tessOCrUtils,p_image,resultType);
|
||||
EXPECT_EQ(true, recognitionResult.flag);
|
||||
EXPECT_EQ("", recognitionResult.message);
|
||||
EXPECT_EQ(ErrorCode::OK, recognitionResult.errorCode);
|
||||
EXPECT_EQ(ResultType::RESULT_STRING, recognitionResult.resultType);
|
||||
delete image;
|
||||
}
|
||||
TEST_F(TessOcrUtilsTest, getRecognizeResultHTML)
|
||||
{
|
||||
QString imagePath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + testImgPath;
|
||||
QImage* image = new QImage(imagePath);
|
||||
ResultType resultType = ResultType::RESULT_HTML;
|
||||
Pix *p_image;
|
||||
p_image = pixCreate(image->width(), image->height(), image->depth());
|
||||
p_image->w = static_cast<l_uint32>(image->width());
|
||||
p_image->h = static_cast<l_uint32>(image->height());
|
||||
p_image->d = static_cast<l_uint32>(image->depth());
|
||||
p_image->spp = 3;
|
||||
p_image->wpl = static_cast<l_uint32>(image->width());
|
||||
p_image->refcount = 1;
|
||||
p_image->xres = 0;
|
||||
p_image->yres = 0;
|
||||
p_image->informat = 0;
|
||||
p_image->special = 0;
|
||||
p_image->text = nullptr;
|
||||
p_image->colormap = nullptr;
|
||||
//p_image->data = reinterpret_cast<l_uint32*>(image->bits());
|
||||
memcpy(reinterpret_cast<void*>(pixGetData(p_image)), reinterpret_cast<void*>(image->bits()), p_image->wpl * p_image->h * 4);
|
||||
RecognitionResult recognitionResult = call_private_fun::TessOcrUtilsgetRecognizeResult(*m_tessOCrUtils,p_image,resultType);
|
||||
EXPECT_EQ(true, recognitionResult.flag);
|
||||
EXPECT_EQ("", recognitionResult.message);
|
||||
EXPECT_EQ(ErrorCode::OK, recognitionResult.errorCode);
|
||||
EXPECT_EQ(ResultType::RESULT_HTML, recognitionResult.resultType);
|
||||
delete image;
|
||||
}
|
||||
|
||||
|
||||
TEST_F(TessOcrUtilsTest, setLanguagesPath)
|
||||
{
|
||||
const QString TessDataPath = "/usr/share/deepin-ocr/tesslangs";
|
||||
bool flag = call_private_fun::TessOcrUtilssetLanguagesPath(*m_tessOCrUtils,TessDataPath);
|
||||
//EXPECT_EQ(true, flag);
|
||||
}
|
||||
|
||||
TEST_F(TessOcrUtilsTest, isExistsResultType)
|
||||
{
|
||||
const QString TessDataPath = "/usr/share/deepin-ocr/tesslangs";
|
||||
bool flag = call_private_fun::TessOcrUtilsisExistsResultType(*m_tessOCrUtils,ResultType::RESULT_STRING);
|
||||
//EXPECT_EQ(true, flag);
|
||||
flag = call_private_fun::TessOcrUtilsisExistsResultType(*m_tessOCrUtils,ResultType::RESULT_HTML);
|
||||
//EXPECT_EQ(true, flag);
|
||||
flag = call_private_fun::TessOcrUtilsisExistsResultType(*m_tessOCrUtils,ResultType::UNKNOWN_TYPE);
|
||||
//EXPECT_EQ(false, flag);
|
||||
}
|
||||
|
||||
TEST_F(TessOcrUtilsTest, getLangStr)
|
||||
{
|
||||
QString lang = call_private_fun::TessOcrUtilsgetLangStr(*m_tessOCrUtils,Languages::ENG);
|
||||
EXPECT_EQ("eng", lang);
|
||||
lang = call_private_fun::TessOcrUtilsgetLangStr(*m_tessOCrUtils,Languages::CHI_SIM);
|
||||
EXPECT_EQ("chi_sim", lang);
|
||||
lang = call_private_fun::TessOcrUtilsgetLangStr(*m_tessOCrUtils,Languages::CHI_TRA);
|
||||
EXPECT_EQ("chi_tra", lang);
|
||||
}
|
||||
|
||||
TEST_F(TessOcrUtilsTest, getSystemLang)
|
||||
{
|
||||
Languages lang = call_private_fun::TessOcrUtilsgetSystemLang(*m_tessOCrUtils);
|
||||
EXPECT_NE(Languages::UNKNOWN_LAN, lang);
|
||||
}
|
||||
|
||||
TEST_F(TessOcrUtilsTest, getLanguages)
|
||||
{
|
||||
QString lang = call_private_fun::TessOcrUtilsgetLanguages(*m_tessOCrUtils);
|
||||
EXPECT_NE("", lang);
|
||||
}
|
||||
|
||||
TEST_F(TessOcrUtilsTest, setResult)
|
||||
{
|
||||
RecognitionResult result ;
|
||||
call_private_fun::TessOcrUtilssetResult(*m_tessOCrUtils,ErrorCode::UNKNOWN,"test",ResultType::RESULT_STRING,result);
|
||||
EXPECT_EQ(false, result.flag);
|
||||
EXPECT_EQ(ErrorCode::UNKNOWN, result.errorCode);
|
||||
EXPECT_EQ("test", result.message);
|
||||
EXPECT_EQ(ResultType::RESULT_STRING, result.resultType);
|
||||
EXPECT_EQ("", result.result);
|
||||
}
|
@ -9,6 +9,11 @@ export QT_LOGGING_RULES="qt.qpa.xcb.*=false"
|
||||
export QT_LOGGING_RULES="qt.qpa.*=false"
|
||||
export QT_LOGGING_RULES="*=false"
|
||||
|
||||
rm -rf ${HOME}/Pictures/ocr_test
|
||||
mkdir -p ${HOME}/Pictures/ocr_test
|
||||
cp -r ./testResource ${HOME}/Pictures/ocr_test
|
||||
cp ../assets/model/* ${HOME}/Pictures/ocr_test/*
|
||||
|
||||
cd ..
|
||||
rm -rf ./build-ut
|
||||
rm -rf ./build
|
||||
@ -26,14 +31,14 @@ then JOBS=1
|
||||
fi
|
||||
|
||||
echo use processor count: $JOBS
|
||||
make -j$JOBS
|
||||
make deepin-ocr_test -j$JOBS
|
||||
|
||||
lcov --directory ./CMakeFiles/deepin-ocr_test.dir --zerocounters
|
||||
./deepin-ocr_test
|
||||
lcov --directory ./src/CMakeFiles/deepin-ocr_test.dir --zerocounters
|
||||
./src/deepin-ocr_test
|
||||
|
||||
lcov --directory . --capture --output-file ./coverageResult/deepin-ocr_Coverage.info
|
||||
echo \ ===================\ do\ filter\ begin\ ====================\
|
||||
lcov --remove ./coverageResult/deepin-ocr_Coverage.info '*/deepin-ocr_test_autogen/*' '*/deepin-ocr_autogen/*' '*/usr/include/*' '*/usr/local/*' '*/tests/*' '*/googletest/*' -o ./coverageResult/deepin-ocr_Coverage.info
|
||||
lcov --remove ./coverageResult/deepin-ocr_Coverage.info '*/3rdparty/*' '*/deepin-ocr_test_autogen/*' '*/deepin-ocr_autogen/*' '*/usr/include/*' '*/usr/local/*' '*/tests/*' '*/googletest/*' -o ./coverageResult/deepin-ocr_Coverage.info
|
||||
echo \ ===================\ do\ filter\ end\ ====================\
|
||||
genhtml -o ./coverageResult/report ./coverageResult/deepin-ocr_Coverage.info
|
||||
|
||||
@ -41,7 +46,7 @@ sleep 2
|
||||
|
||||
lcov --directory . --capture --output-file ./coverageResult/deepin-ocr_Coverage.info
|
||||
echo \ ===================\ do\ filter\ begin\ ====================\
|
||||
lcov --remove ./coverageResult/deepin-ocr_Coverage.info '*/deepin-ocr_test_autogen/*' '*/deepin-ocr_autogen/*' '*/usr/include/*' '*/usr/local/*' '*/tests/*' '*/googletest/*' -o ./coverageResult/deepin-ocr_Coverage.info
|
||||
lcov --remove ./coverageResult/deepin-ocr_Coverage.info '*/3rdparty/*' '*/deepin-ocr_test_autogen/*' '*/deepin-ocr_autogen/*' '*/usr/include/*' '*/usr/local/*' '*/tests/*' '*/googletest/*' -o ./coverageResult/deepin-ocr_Coverage.info
|
||||
echo \ ===================\ do\ filter\ end\ ====================\
|
||||
genhtml -o ./coverageResult/report ./coverageResult/deepin-ocr_Coverage.info
|
||||
|
||||
|
BIN
tests/testResource/test.png
Normal file
BIN
tests/testResource/test.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 125 KiB |
@ -43,12 +43,12 @@ TEST(MainWindow, mainwindow)
|
||||
//初始拉起主界面,带有参数的
|
||||
TEST(MainWindow, mainwindow_openFile)
|
||||
{
|
||||
QString picPath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + "/Wallpapers/luca-micheli-ruWkmt3nU58-unsplash.jpg";
|
||||
QString picPath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + "/ocr_test/testResource/test.png";
|
||||
OcrApplication instance;
|
||||
instance.openFile(picPath);
|
||||
bool bRet = false;
|
||||
while (!bRet) {
|
||||
if (!TessOcrUtils::instance()->isRunning()) {
|
||||
if (!PaddleOCRApp::instance()->isRunning()) {
|
||||
bRet = true;
|
||||
QTest::qWait(1000);
|
||||
}
|
||||
@ -58,7 +58,7 @@ TEST(MainWindow, mainwindow_openFile)
|
||||
|
||||
bRet = false;
|
||||
while (!bRet) {
|
||||
if (!TessOcrUtils::instance()->isRunning()) {
|
||||
if (!PaddleOCRApp::instance()->isRunning()) {
|
||||
bRet = true;
|
||||
QTest::qWait(1000);
|
||||
}
|
||||
|
@ -72,119 +72,143 @@ QAction *exec_stub(void* obj, const QPoint &pos, QAction *at)
|
||||
}
|
||||
TEST(ResultTextView, mainwindow)
|
||||
{
|
||||
Stub stub;
|
||||
{
|
||||
ResultTextView* reTextView = new ResultTextView(nullptr);
|
||||
QResizeEvent resizeEvent(QSize(500, 200), QSize(500, 400));
|
||||
reTextView->resizeEvent(&resizeEvent);
|
||||
|
||||
ResultTextView* reTextView = new ResultTextView(nullptr);
|
||||
QResizeEvent resizeEvent(QSize(500, 200), QSize(500, 400));
|
||||
reTextView->resizeEvent(&resizeEvent);
|
||||
QMouseEvent *ev = new QMouseEvent(QEvent::MouseMove, QPoint(15,36), QPoint(25,40), QPoint(60,80), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt);
|
||||
reTextView->m_gestureAction = ResultTextView::GA_slide;
|
||||
reTextView->mouseMoveEvent(ev);
|
||||
delete ev;
|
||||
|
||||
QMouseEvent *ev = new QMouseEvent(QEvent::MouseMove, QPoint(15,36), QPoint(25,40), QPoint(60,80), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt);
|
||||
reTextView->m_gestureAction = ResultTextView::GA_slide;
|
||||
reTextView->mouseMoveEvent(ev);
|
||||
delete ev;
|
||||
Stub stub;
|
||||
|
||||
stub.set((QAction*(QMenu::*)(const QPoint &, QAction *))ADDR(QMenu, exec), exec_stub);
|
||||
reTextView->contextMenuEvent(nullptr);
|
||||
stub.reset((QAction*(QMenu::*)(const QPoint &, QAction *))ADDR(QMenu, exec));
|
||||
stub.set((QAction*(QMenu::*)(const QPoint &, QAction *))ADDR(QMenu, exec), exec_stub);
|
||||
reTextView->contextMenuEvent(nullptr);
|
||||
stub.reset((QAction*(QMenu::*)(const QPoint &, QAction *))ADDR(QMenu, exec));
|
||||
|
||||
QMouseEvent *evPress = new QMouseEvent(QEvent::MouseButtonPress, QPoint(15,36), QPoint(25,40), QPoint(60,80), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt);
|
||||
reTextView->mousePressEvent(evPress);
|
||||
delete evPress;
|
||||
|
||||
QMouseEvent *evPress = new QMouseEvent(QEvent::MouseButtonPress, QPoint(15,36), QPoint(25,40), QPoint(60,80), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt);
|
||||
reTextView->mousePressEvent(evPress);
|
||||
delete evPress;
|
||||
QMouseEvent *evRele = new QMouseEvent(QEvent::MouseButtonRelease, QPoint(15,36), QPoint(25,40), QPoint(60,80), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt);
|
||||
reTextView->mouseReleaseEvent(evRele);
|
||||
delete evRele;
|
||||
|
||||
QMouseEvent *evRele = new QMouseEvent(QEvent::MouseButtonRelease, QPoint(15,36), QPoint(25,40), QPoint(60,80), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier, Qt::MouseEventSynthesizedByQt);
|
||||
reTextView->mouseReleaseEvent(evRele);
|
||||
delete evRele;
|
||||
QList<QGesture*> list;
|
||||
QTapGesture* tap = new QTapGesture();
|
||||
list.append(tap);
|
||||
QGestureEvent *gestureEvent = new QGestureEvent(list);
|
||||
reTextView->event(gestureEvent);
|
||||
stub.set(ADDR(QTapGesture,state), state_stub);
|
||||
reTextView->event(gestureEvent);
|
||||
stub.reset(ADDR(QTapGesture,state));
|
||||
stub.set(ADDR(QTapGesture,state), state_stub1);
|
||||
reTextView->event(gestureEvent);
|
||||
stub.reset(ADDR(QTapGesture,state));
|
||||
stub.set(ADDR(QTapGesture,state), state_stub2);
|
||||
reTextView->event(gestureEvent);
|
||||
stub.reset(ADDR(QTapGesture,state));
|
||||
stub.set(ADDR(QTapGesture,state), state_stub3);
|
||||
reTextView->event(gestureEvent);
|
||||
stub.reset(ADDR(QTapGesture,state));
|
||||
|
||||
delete gestureEvent;
|
||||
delete tap;
|
||||
delete reTextView;
|
||||
}
|
||||
|
||||
QList<QGesture*> list;
|
||||
QTapGesture* tap = new QTapGesture();
|
||||
list.append(tap);
|
||||
QGestureEvent *gestureEvent = new QGestureEvent(list);
|
||||
reTextView->event(gestureEvent);
|
||||
stub.set(ADDR(QTapGesture,state), state_stub);
|
||||
reTextView->event(gestureEvent);
|
||||
stub.reset(ADDR(QTapGesture,state));
|
||||
stub.set(ADDR(QTapGesture,state), state_stub1);
|
||||
reTextView->event(gestureEvent);
|
||||
stub.reset(ADDR(QTapGesture,state));
|
||||
stub.set(ADDR(QTapGesture,state), state_stub2);
|
||||
reTextView->event(gestureEvent);
|
||||
stub.reset(ADDR(QTapGesture,state));
|
||||
stub.set(ADDR(QTapGesture,state), state_stub3);
|
||||
reTextView->event(gestureEvent);
|
||||
stub.reset(ADDR(QTapGesture,state));
|
||||
{
|
||||
ResultTextView* reTextView = new ResultTextView(nullptr);
|
||||
QResizeEvent resizeEvent(QSize(500, 200), QSize(500, 400));
|
||||
reTextView->resizeEvent(&resizeEvent);
|
||||
|
||||
delete gestureEvent;
|
||||
delete tap;
|
||||
Stub stub;
|
||||
|
||||
QList<QGesture*> list1;
|
||||
QTapAndHoldGesture* tapAndHold = new QTapAndHoldGesture();
|
||||
list1.append(tapAndHold);
|
||||
QGestureEvent *gestureEvent1 = new QGestureEvent(list1);
|
||||
reTextView->event(gestureEvent1);
|
||||
stub.set(ADDR(QTapAndHoldGesture,state), state_stub);
|
||||
reTextView->event(gestureEvent1);
|
||||
stub.reset(ADDR(QTapAndHoldGesture,state));
|
||||
stub.set(ADDR(QTapAndHoldGesture,state), state_stub1);
|
||||
reTextView->event(gestureEvent1);
|
||||
stub.reset(ADDR(QTapAndHoldGesture,state));
|
||||
stub.set(ADDR(QTapAndHoldGesture,state), state_stub2);
|
||||
reTextView->event(gestureEvent1);
|
||||
stub.reset(ADDR(QTapAndHoldGesture,state));
|
||||
stub.set(ADDR(QTapAndHoldGesture,state), state_stub3);
|
||||
reTextView->event(gestureEvent1);
|
||||
stub.reset(ADDR(QTapAndHoldGesture,state));
|
||||
|
||||
QList<QGesture*> list1;
|
||||
QTapAndHoldGesture* tapAndHold = new QTapAndHoldGesture();
|
||||
list1.append(tapAndHold);
|
||||
QGestureEvent *gestureEvent1 = new QGestureEvent(list1);
|
||||
reTextView->event(gestureEvent1);
|
||||
stub.set(ADDR(QTapAndHoldGesture,state), state_stub);
|
||||
reTextView->event(gestureEvent1);
|
||||
stub.reset(ADDR(QTapAndHoldGesture,state));
|
||||
stub.set(ADDR(QTapAndHoldGesture,state), state_stub1);
|
||||
reTextView->event(gestureEvent1);
|
||||
stub.reset(ADDR(QTapAndHoldGesture,state));
|
||||
stub.set(ADDR(QTapAndHoldGesture,state), state_stub2);
|
||||
reTextView->event(gestureEvent1);
|
||||
stub.reset(ADDR(QTapAndHoldGesture,state));
|
||||
stub.set(ADDR(QTapAndHoldGesture,state), state_stub3);
|
||||
reTextView->event(gestureEvent1);
|
||||
stub.reset(ADDR(QTapAndHoldGesture,state));
|
||||
delete gestureEvent1;
|
||||
delete tapAndHold;
|
||||
delete gestureEvent1;
|
||||
delete tapAndHold;
|
||||
delete reTextView;
|
||||
}
|
||||
|
||||
QList<QGesture*> list2;
|
||||
QPanGesture* pan = new QPanGesture();
|
||||
list2.append(pan);
|
||||
QGestureEvent *gestureEvent2 = new QGestureEvent(list2);
|
||||
reTextView->event(gestureEvent2);
|
||||
stub.set(ADDR(QPanGesture,state), state_stub);
|
||||
reTextView->event(gestureEvent2);
|
||||
stub.reset(ADDR(QPanGesture,state));
|
||||
stub.set(ADDR(QPanGesture,state), state_stub1);
|
||||
reTextView->event(gestureEvent2);
|
||||
stub.reset(ADDR(QPanGesture,state));
|
||||
stub.set(ADDR(QPanGesture,state), state_stub2);
|
||||
reTextView->event(gestureEvent2);
|
||||
stub.reset(ADDR(QPanGesture,state));
|
||||
stub.set(ADDR(QPanGesture,state), state_stub3);
|
||||
reTextView->event(gestureEvent2);
|
||||
stub.reset(ADDR(QPanGesture,state));
|
||||
delete gestureEvent2;
|
||||
delete pan;
|
||||
{
|
||||
ResultTextView* reTextView = new ResultTextView(nullptr);
|
||||
QResizeEvent resizeEvent(QSize(500, 200), QSize(500, 400));
|
||||
reTextView->resizeEvent(&resizeEvent);
|
||||
|
||||
QList<QGesture*> list3;
|
||||
QPinchGesture* pinch = new QPinchGesture();
|
||||
list3.append(pinch);
|
||||
QGestureEvent *gestureEvent3 = new QGestureEvent(list3);
|
||||
reTextView->event(gestureEvent3);
|
||||
stub.set(ADDR(QPinchGesture,state), state_stub);
|
||||
reTextView->event(gestureEvent3);
|
||||
stub.reset(ADDR(QPinchGesture,state));
|
||||
stub.set(ADDR(QPinchGesture,state), state_stub1);
|
||||
reTextView->event(gestureEvent3);
|
||||
stub.reset(ADDR(QPinchGesture,state));
|
||||
stub.set(ADDR(QPinchGesture,state), state_stub2);
|
||||
reTextView->event(gestureEvent3);
|
||||
stub.reset(ADDR(QPinchGesture,state));
|
||||
stub.set(ADDR(QPinchGesture,state), state_stub3);
|
||||
reTextView->event(gestureEvent3);
|
||||
stub.reset(ADDR(QPinchGesture,state));
|
||||
delete gestureEvent3;
|
||||
delete pinch;
|
||||
Stub stub;
|
||||
|
||||
reTextView->slideGestureY(2.5);
|
||||
reTextView->slideGestureX(2.5);
|
||||
QList<QGesture*> list2;
|
||||
QPanGesture* pan = new QPanGesture();
|
||||
list2.append(pan);
|
||||
QGestureEvent *gestureEvent2 = new QGestureEvent(list2);
|
||||
reTextView->event(gestureEvent2);
|
||||
stub.set(ADDR(QPanGesture,state), state_stub);
|
||||
reTextView->event(gestureEvent2);
|
||||
stub.reset(ADDR(QPanGesture,state));
|
||||
stub.set(ADDR(QPanGesture,state), state_stub1);
|
||||
reTextView->event(gestureEvent2);
|
||||
stub.reset(ADDR(QPanGesture,state));
|
||||
stub.set(ADDR(QPanGesture,state), state_stub2);
|
||||
reTextView->event(gestureEvent2);
|
||||
stub.reset(ADDR(QPanGesture,state));
|
||||
stub.set(ADDR(QPanGesture,state), state_stub3);
|
||||
reTextView->event(gestureEvent2);
|
||||
stub.reset(ADDR(QPanGesture,state));
|
||||
|
||||
delete reTextView;
|
||||
delete gestureEvent2;
|
||||
delete pan;
|
||||
delete reTextView;
|
||||
}
|
||||
|
||||
{
|
||||
ResultTextView* reTextView = new ResultTextView(nullptr);
|
||||
QResizeEvent resizeEvent(QSize(500, 200), QSize(500, 400));
|
||||
reTextView->resizeEvent(&resizeEvent);
|
||||
|
||||
Stub stub;
|
||||
|
||||
QList<QGesture*> list3;
|
||||
QPinchGesture* pinch = new QPinchGesture();
|
||||
list3.append(pinch);
|
||||
QGestureEvent *gestureEvent3 = new QGestureEvent(list3);
|
||||
reTextView->event(gestureEvent3);
|
||||
stub.set(ADDR(QPinchGesture,state), state_stub);
|
||||
reTextView->event(gestureEvent3);
|
||||
stub.reset(ADDR(QPinchGesture,state));
|
||||
stub.set(ADDR(QPinchGesture,state), state_stub1);
|
||||
reTextView->event(gestureEvent3);
|
||||
stub.reset(ADDR(QPinchGesture,state));
|
||||
stub.set(ADDR(QPinchGesture,state), state_stub2);
|
||||
reTextView->event(gestureEvent3);
|
||||
stub.reset(ADDR(QPinchGesture,state));
|
||||
stub.set(ADDR(QPinchGesture,state), state_stub3);
|
||||
reTextView->event(gestureEvent3);
|
||||
stub.reset(ADDR(QPinchGesture,state));
|
||||
delete gestureEvent3;
|
||||
delete pinch;
|
||||
|
||||
reTextView->slideGestureY(2.5);
|
||||
reTextView->slideGestureX(2.5);
|
||||
|
||||
delete reTextView;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user