Commit 519b74ad by xiaojing.zhang

GoogleTest隐藏弹出框

parent 50ade67c
......@@ -22,9 +22,11 @@
//#define PARTNER_ID "c3e82ff2-6285-4823-8e3f-7ec880ae7119"
//! 测试
#ifdef UNIT_TEST
#define APP_ID "T015"
#define KEY_CODE "85870ccc8da9affa5eafe7488533f273"
#define PARTNER_ID "7f657d18-9f3f-41fd-b97f-1a71f7d1ffa0"
#endif
// 请求类型的枚举值
enum FM_TYPE {
......
......@@ -95,18 +95,15 @@ void FMTask::showWindow()
if(_window != nullptr) {
_window->initWnd(this->session());
int ret;
/*
#ifdef UNIT_TEST
if(_FM_Type == FM_Login || _FM_Type == FM_Pay )
if(_FM_Type == FM_Login || _FM_Type == FM_Pay ||_FM_Type == FM_Refund )
ret = 1;
else
ret = _window->exec();
#else
ret = _window->exec();
#endif
*/
ret = _window->exec();
if(ret != 1) {
setError(FM_API_WINDOWCLOSE);
}
......
......@@ -82,11 +82,10 @@ void TaskLogin::onLogin()
bool canPay = (getServerJsonValue(PosProps.CanPay).toInt() == 1);
/*
#ifdef UNIT_TEST
canPay = true;
#endif
*/
if(!canPay) {
if(getPosJsonValue(PosProps.Fm_cmd).toInt() != FM_Pay) {
FMMsgWnd::LoginSuccess(account, name, birthday, _window);
......
......@@ -73,37 +73,45 @@ int FMMsgWnd::_exec(InfoType type, const QString &info)
void FMMsgWnd::FailureWnd(const QString &info, QDialog *parent)
{
#ifndef UNIT_TEST
FMMsgWnd window(parent);
if(parent != nullptr) {
window.setGeometry(parent->geometry());
}
window._exec(FMMsgWnd::T_Failure, info);
#endif
}
void FMMsgWnd::WarningWnd(const QString &info, QDialog *parent)
{
#ifndef UNIT_TEST
FMMsgWnd window(parent);
if(parent != nullptr) {
window.setGeometry(parent->geometry());
}
window._exec(FMMsgWnd::T_Warning, info);
#endif
}
void FMMsgWnd::SuccessWnd(const QString &info, QDialog *parent)
{
#ifndef UNIT_TEST
FMMsgWnd window(parent);
if(parent != nullptr) {
window.setGeometry(parent->geometry());
}
window._exec(FMMsgWnd::T_Success, info);
#endif
}
void FMMsgWnd::LoginSuccess(const QString &account, const QString &name, const QString &birthday, QDialog *parent)
{
#ifndef UNIT_TEST
FMMsgWnd window(parent);
if(parent != nullptr) {
window.setGeometry(parent->geometry());
}
QString info = QString::fromLocal8Bit("账号:%1\n姓名:%2\n生日:%3").arg(account).arg(name).arg(birthday);
window._exec(FMMsgWnd::T_LoginSuccess, info);
#endif
}
int FMMsgWnd::Question(const QString &info, QDialog *parent)
......
......@@ -47,12 +47,6 @@ bool FMVipLogin::initWnd(Session *session)
QString placeText;
if(session->data(PosProps.FM_Type).toInt() == FM_Pay) {
placeText = QString::fromLocal8Bit("输入支付码");
#ifdef UNIT_TEST
QString paycode = GetPayCode();
QTest::keyClicks(ui->login_edit, paycode);
//QTest::mouseClick(ui->login_btn,Qt::LeftButton);
#endif
} else {
placeText = QString::fromLocal8Bit("输入手机号/会员码/支付码");
}
......@@ -62,7 +56,12 @@ bool FMVipLogin::initWnd(Session *session)
ui->operator_label->setText(session->data(PosProps.OperatorId).toString());
ui->bd_label->setText(session->data(PosProps.BussinessDate).toString());
ui->login_edit->setPlaceholderText(placeText);
#ifdef UNIT_TEST
QString paycode = GetPayCode();
QTest::keyClicks(ui->login_edit, paycode);
QTest::mouseClick(ui->login_btn,Qt::LeftButton);
#endif
return true;
}
QString FMVipLogin::getVersionInfo()
......@@ -114,7 +113,7 @@ QString FMVipLogin::GetPayCode()
QNetworkAccessManager networkAcessManager;
QNetworkRequest _req;
QString codeFormat;
QString url = "http://jtest.sandload.cn:8748/wechat/card/getPayCode?partnerId=7f657d18-9f3f-41fd-b97f-1a71f7d1ffa0&openId=o4_93jjwHWPke-U1IT2IkUO5hbII&mobile=15821343897&URL=http%3A%2F%2Fjtest.sandload.cn";
QString url = "http://membertest1.sandload.cn:8748/wechat/card/getPayCode?partnerId=7f657d18-9f3f-41fd-b97f-1a71f7d1ffa0&openId=o4_93jjwHWPke-U1IT2IkUO5hbII&mobile=15821343897&URL=http%3A%2F%2Fjtest.sandload.cn";
_req.setUrl(url);
auto reply = networkAcessManager.get(_req);
QEventLoop loop;
......
......@@ -6,11 +6,11 @@
#include "fmnumpad.h"
#include <QScrollBar>
#include <QItemSelectionModel>
/*
#ifdef UNIT_TEST
#include <QTest>
#endif
*/
FMVipOrder::FMVipOrder(QDialog *parent) :
FMVipWnd(parent),
......@@ -88,11 +88,11 @@ bool FMVipOrder::initWnd(Session *session)
ui->pay_edit->setValidator(new QRegExpValidator(regexp));
ui->score_edit->setValidator(new QRegExpValidator(regexp));
setWillPayText();
/*
#ifdef UNIT_TEST
QTest::mouseClick(ui->pay_btn,Qt::LeftButton);
#endif
*/
return true;
}
......
......@@ -108,6 +108,9 @@ bool FMVipRefund::initWnd(Session *session)
col = 0;
}
}
#ifdef UNIT_TEST
UiAutoTest();
#endif
return true;
}
......@@ -149,7 +152,7 @@ void FMVipRefund::setIsRefundSuccess(bool isRefundSuccess)
_isRefundSuccess = isRefundSuccess;
}
/*
//测试程序自动退款时退最近的一笔
#ifdef UNIT_TEST
void FMVipRefund::UiAutoTest()
......@@ -162,4 +165,4 @@ void FMVipRefund::UiAutoTest()
QTest::mouseClick(ui->close_btn,Qt::LeftButton);
}
#endif
*/
......@@ -27,11 +27,11 @@ public:
bool isRefundSuccess() const;
void setIsRefundSuccess(bool isRefundSuccess);
/*
#ifdef UNIT_TEST
void UiAutoTest();
#endif
*/
signals:
void refundPay(int);
......
......@@ -7,7 +7,6 @@
#include "fmtask.h"
#include "fmnumpad.h"
#include "readjsoncommand.h"
#include "loadrelyplugin.h"
#include <QByteArray>
#include <gtest/gtest.h>
......@@ -126,7 +125,7 @@ QByteArray VipRefund()
////////////////////////////////////////////////////////////////////////
/*
TEST(TestNewVip, Vip_InfoFailed)
{
DeleteLocalDB();
......@@ -134,6 +133,7 @@ TEST(TestNewVip, Vip_InfoFailed)
rspData = VipInfo();
ASSERT_FALSE(respDataDetect(rspData));
}
*/
//设置门店信息
TEST(TestNewVip, store_Info)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment