mirror of
https://github.com/QuasarApp/DoctorPill.git
synced 2025-05-13 01:49:45 +00:00
simple test
This commit is contained in:
parent
527364b6fc
commit
5e8283cea7
@ -26,11 +26,88 @@ public:
|
||||
|
||||
protected:
|
||||
bool diagnostic() const override {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
return true;
|
||||
};
|
||||
bool fix() const override {
|
||||
return false;
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
class EmptyPill1: public DP::iPill {
|
||||
|
||||
|
||||
// iPill interface
|
||||
public:
|
||||
QString name() const override {
|
||||
return "EmptyPill1";
|
||||
};
|
||||
|
||||
QString description() const override {
|
||||
return "Pill For Test. This pill cant be fixed ";
|
||||
};
|
||||
|
||||
protected:
|
||||
bool diagnostic() const override {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
return true;
|
||||
};
|
||||
bool fix() const override {
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class EmptyPill2: public DP::iPill {
|
||||
|
||||
|
||||
// iPill interface
|
||||
public:
|
||||
QString name() const override {
|
||||
return "EmptyPill2";
|
||||
};
|
||||
|
||||
QString description() const override {
|
||||
return "Pill For Test. This pill cant be fixed ";
|
||||
};
|
||||
|
||||
protected:
|
||||
bool diagnostic() const override {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
return true;
|
||||
};
|
||||
bool fix() const override {
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
class LongPill: public DP::iPill {
|
||||
|
||||
|
||||
// iPill interface
|
||||
public:
|
||||
QString name() const override {
|
||||
return "Long Pill ";
|
||||
};
|
||||
|
||||
QString description() const override {
|
||||
return "Lorem Ipsum is simply dummy text of the printing and typesetting industry."
|
||||
" Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,"
|
||||
" when an unknown printer took a galley of type and scrambled it to make a type specimen book."
|
||||
" It has survived not only five centuries,"
|
||||
" but also the leap into electronic typesetting,"
|
||||
" remaining essentially unchanged."
|
||||
" It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,"
|
||||
" and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. ";
|
||||
};
|
||||
|
||||
protected:
|
||||
bool diagnostic() const override {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
return true;
|
||||
};
|
||||
bool fix() const override {
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
@ -45,7 +122,10 @@ int main(int argc, char *argv[]) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
DP::DoctorModel model({QSharedPointer<EmptyPill>::create()});
|
||||
DP::DoctorModel model({QSharedPointer<EmptyPill>::create(),
|
||||
QSharedPointer<LongPill>::create(),
|
||||
QSharedPointer<EmptyPill1>::create(),
|
||||
QSharedPointer<EmptyPill2>::create()});
|
||||
|
||||
engine.load("qrc:/Main.qml");
|
||||
if (engine.rootObjects().isEmpty())
|
||||
|
@ -6,4 +6,9 @@
|
||||
<qresource prefix="/DoctorPillTr">
|
||||
<file>languages/en.qm</file>
|
||||
</qresource>
|
||||
<qresource prefix="/icons">
|
||||
<file>icons/Failed.png</file>
|
||||
<file>icons/Found.png</file>
|
||||
<file>icons/Solved.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -24,7 +24,7 @@ bool DoctorTest::test(const QSharedPointer<iPill> &pill,
|
||||
return false;
|
||||
}
|
||||
|
||||
return pill->diagnostic();
|
||||
return !pill->diagnostic();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,6 +49,10 @@ QVariant DoctorModel::data(const QModelIndex &index, int role) const {
|
||||
return "Internal Error";
|
||||
}
|
||||
|
||||
if ( role == Roles::Row) {
|
||||
return index.row();
|
||||
}
|
||||
|
||||
if (role == Roles::Name) {
|
||||
return item._pill->name();
|
||||
}
|
||||
@ -70,17 +74,22 @@ QHash<int, QByteArray> DoctorModel::roleNames() const {
|
||||
roles[Roles::Name] = "issueName";
|
||||
roles[Roles::Description] = "issueDescription";
|
||||
roles[Roles::Status] = "issueStatus";
|
||||
roles[Roles::Row] = "row";
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
||||
void DoctorModel::usePill(QString pillName) {
|
||||
|
||||
auto pill = _viewData.value(pillName, {});
|
||||
if (!pill._pill)
|
||||
return;
|
||||
auto work = [this, pillName](){
|
||||
auto pill = _viewData.value(pillName, {});
|
||||
if (!pill._pill)
|
||||
return;
|
||||
|
||||
_doctor.fix({pill._pill});
|
||||
_doctor.fix({pill._pill});
|
||||
};
|
||||
|
||||
auto val = QtConcurrent::run(work);
|
||||
}
|
||||
|
||||
void DoctorModel::diagnostic() {
|
||||
@ -94,18 +103,41 @@ void DoctorModel::diagnostic() {
|
||||
auto val = QtConcurrent::run(work);
|
||||
}
|
||||
|
||||
void DoctorModel::drop(int row) {
|
||||
if (row < 0 || row >= rowCount()) {
|
||||
return;
|
||||
}
|
||||
|
||||
beginRemoveRows(QModelIndex{}, row, row);
|
||||
_viewData.erase(std::next(_viewData.begin(), row));
|
||||
endRemoveRows();
|
||||
|
||||
if (!_viewData.size()) {
|
||||
setState(ViewState::AllIsFine);
|
||||
}
|
||||
}
|
||||
|
||||
void DoctorModel::handleFixFailed(QList<QSharedPointer<iPill>> failed) {
|
||||
|
||||
|
||||
for (const auto &pill : qAsConst(failed)) {
|
||||
_viewData[pill->name()]._status = static_cast<int>(IssueStatus::Failed);
|
||||
}
|
||||
|
||||
emit dataChanged(index(0,0), index(rowCount() - 1, 0),
|
||||
QVector<int>() << Roles::Status);
|
||||
|
||||
}
|
||||
|
||||
void DoctorModel::handleFixSuccessful(QList<QSharedPointer<iPill>> successful) {
|
||||
|
||||
|
||||
for (const auto &pill : qAsConst(successful)) {
|
||||
_viewData[pill->name()]._status = static_cast<int>(IssueStatus::Solved);
|
||||
}
|
||||
|
||||
emit dataChanged(index(0,0), index(rowCount() - 1, 0),
|
||||
QVector<int>() << Roles::Status);
|
||||
}
|
||||
|
||||
void DoctorModel::handleDiagnostcFinished(QList<QSharedPointer<iPill> > issues) {
|
||||
|
@ -32,7 +32,8 @@ class DoctorModel: public QAbstractListModel
|
||||
|
||||
Name = Qt::UserRole,
|
||||
Description,
|
||||
Status
|
||||
Status,
|
||||
Row
|
||||
};
|
||||
|
||||
enum IssueStatus {
|
||||
@ -59,6 +60,7 @@ public:
|
||||
|
||||
Q_INVOKABLE void usePill(QString pillName);
|
||||
Q_INVOKABLE void diagnostic();
|
||||
Q_INVOKABLE void drop(int row);
|
||||
|
||||
double progress() const;
|
||||
int state() const;
|
||||
|
@ -12,15 +12,6 @@ Page {
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
|
||||
Label {
|
||||
id: atansionMsg
|
||||
text: qsTr("Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.");
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
wrapMode: Label.WordWrap
|
||||
Layout.fillWidth: true
|
||||
|
||||
}
|
||||
|
||||
Label {
|
||||
id: descriptionMsg
|
||||
@ -32,9 +23,33 @@ Page {
|
||||
|
||||
}
|
||||
|
||||
Label {
|
||||
id: atansionMsg
|
||||
text: qsTr("<b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.")
|
||||
+ qsTr(" For begin diagnosticc enter please next line: ") + "<b>" + privateRoot.enterString + "</b>";
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
wrapMode: Label.WordWrap
|
||||
Layout.fillWidth: true
|
||||
|
||||
}
|
||||
|
||||
Image {
|
||||
id: allIsFineImg
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: "qrc:/icons/icons/Solved.png"
|
||||
Layout.preferredHeight: 100
|
||||
Layout.preferredWidth: 100
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
}
|
||||
|
||||
Label {
|
||||
id: allIsFineMsg
|
||||
text: qsTr("The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers.");
|
||||
text: qsTr("The Doctor not found any issues. If you sure that application is works wrong then you can contact with developers.")
|
||||
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
wrapMode: Label.WordWrap
|
||||
@ -44,6 +59,7 @@ Page {
|
||||
|
||||
Button {
|
||||
id: contactButton
|
||||
|
||||
text: qsTr("Contact with Developers");
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
onClicked: {
|
||||
@ -51,37 +67,79 @@ Page {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ProgressBar {
|
||||
id: progress
|
||||
indeterminate: true;
|
||||
}
|
||||
|
||||
Button {
|
||||
id: diagnosticButton
|
||||
text: qsTr("Diagnostic");
|
||||
indeterminate: value < 0.01;
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
onClicked: {
|
||||
if (root.model) {
|
||||
root.model.diagnostic();
|
||||
from: 0
|
||||
to: 1
|
||||
|
||||
value: (root.model)? root.model.progress: 0
|
||||
|
||||
Behavior on value {
|
||||
NumberAnimation {
|
||||
duration: 500
|
||||
easing.type: Easing.OutQuad
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: diagnosticButton
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
TextField {
|
||||
id: confirmInput
|
||||
placeholderText: qsTr("Enter: ") + privateRoot.enterString
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Diagnostic");
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
enabled: confirmInput.text.toLowerCase() ===
|
||||
privateRoot.enterString.toLowerCase()
|
||||
|
||||
onClicked: {
|
||||
if (root.model) {
|
||||
root.model.diagnostic();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
id: list
|
||||
anchors.fill: parent
|
||||
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
model: root.model
|
||||
visible: (root.model)? root.model.rowCount(): false
|
||||
spacing: 20
|
||||
|
||||
leftMargin: 10
|
||||
rightMargin: 10
|
||||
topMargin: 10
|
||||
bottomMargin: 10
|
||||
|
||||
delegate: Component {
|
||||
RowLayout {
|
||||
|
||||
width: Math.min(list.width - list.leftMargin - list.rightMargin, 1024)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
function getSourceImage(status) {
|
||||
switch(status) {
|
||||
case 0: return ""; // detected
|
||||
case 1: return ""; // solved
|
||||
case 2: return ""; // failed
|
||||
default: return "";// unknown status
|
||||
case 0: return "qrc:/icons/icons/Found.png"; // detected
|
||||
case 1: return "qrc:/icons/icons/Solved.png"; // solved
|
||||
case 2: return "qrc:/icons/icons/Failed.png"; // failed
|
||||
default: return "";// unknown status
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,27 +151,63 @@ Page {
|
||||
id: bugStatuss
|
||||
fillMode: Image.PreserveAspectFit
|
||||
source: getSourceImage(issueStatus)
|
||||
Layout.preferredHeight: 60
|
||||
Layout.preferredWidth: height
|
||||
Layout.preferredHeight: 80
|
||||
Layout.preferredWidth: 80
|
||||
}
|
||||
|
||||
Label {
|
||||
text: issueName
|
||||
}
|
||||
ColumnLayout {
|
||||
id: textBlock
|
||||
Layout.fillWidth: true
|
||||
|
||||
Label {
|
||||
text: issueDescription
|
||||
Label {
|
||||
text: issueName
|
||||
horizontalAlignment: Qt.AlignLeft
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
wrapMode: Label.WordWrap
|
||||
|
||||
font.bold: true
|
||||
font.pixelSize: 20
|
||||
}
|
||||
|
||||
Label {
|
||||
text: issueDescription
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Qt.AlignLeft
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
wrapMode: Label.WordWrap
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Repair");
|
||||
visible: issueStatus === 0
|
||||
onClicked: {
|
||||
if (root.model) {
|
||||
root.model.usePill(issueName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Drop");
|
||||
visible: issueStatus === 1
|
||||
onClicked: {
|
||||
if (root.model) {
|
||||
root.model.drop(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Fix failed ;( ")
|
||||
font.bold: true
|
||||
visible: issueStatus === 2
|
||||
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
width: list.width
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -139,6 +233,11 @@ Page {
|
||||
visible: true
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: allIsFineImg;
|
||||
visible: false
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: allIsFineMsg;
|
||||
visible: false
|
||||
@ -159,6 +258,7 @@ Page {
|
||||
visible: true
|
||||
}
|
||||
|
||||
|
||||
PropertyChanges {
|
||||
target: list;
|
||||
visible: false
|
||||
@ -177,6 +277,11 @@ Page {
|
||||
visible: false
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: allIsFineImg;
|
||||
visible: false
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: allIsFineMsg;
|
||||
visible: false
|
||||
@ -215,6 +320,11 @@ Page {
|
||||
visible: false
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: allIsFineImg;
|
||||
visible: false
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: allIsFineMsg;
|
||||
visible: false
|
||||
@ -253,6 +363,11 @@ Page {
|
||||
visible: false
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: allIsFineImg;
|
||||
visible: true
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: allIsFineMsg;
|
||||
visible: true
|
||||
@ -283,6 +398,8 @@ Page {
|
||||
Item {
|
||||
id: privateRoot
|
||||
|
||||
property string enterString: qsTr("I know what I'm doing")
|
||||
|
||||
function getState(state) {
|
||||
switch(state) {
|
||||
case 0: return "beginDiagnostic";
|
||||
|
BIN
src/Library/icons/Failed.png
Normal file
BIN
src/Library/icons/Failed.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 70 KiB |
BIN
src/Library/icons/Found.png
Normal file
BIN
src/Library/icons/Found.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 52 KiB |
BIN
src/Library/icons/Solved.png
Normal file
BIN
src/Library/icons/Solved.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 70 KiB |
@ -3,10 +3,6 @@
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>DoctorView</name>
|
||||
<message>
|
||||
<source>Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -27,5 +23,29 @@
|
||||
<source>Repair</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> For begin diagnosticc enter please next line: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Drop</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fix failed ;( </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I know what I'm doing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -3,10 +3,6 @@
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>DoctorView</name>
|
||||
<message>
|
||||
<source>Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -27,5 +23,29 @@
|
||||
<source>Repair</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> For begin diagnosticc enter please next line: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Drop</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fix failed ;( </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I know what I'm doing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -3,10 +3,6 @@
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>DoctorView</name>
|
||||
<message>
|
||||
<source>Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -27,5 +23,29 @@
|
||||
<source>Repair</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> For begin diagnosticc enter please next line: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Drop</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fix failed ;( </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I know what I'm doing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -3,10 +3,6 @@
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>DoctorView</name>
|
||||
<message>
|
||||
<source>Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -27,5 +23,29 @@
|
||||
<source>Repair</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> For begin diagnosticc enter please next line: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Drop</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fix failed ;( </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I know what I'm doing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -3,10 +3,6 @@
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>DoctorView</name>
|
||||
<message>
|
||||
<source>Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -27,5 +23,29 @@
|
||||
<source>Repair</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> For begin diagnosticc enter please next line: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Drop</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fix failed ;( </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I know what I'm doing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -3,10 +3,6 @@
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>DoctorView</name>
|
||||
<message>
|
||||
<source>Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -27,5 +23,29 @@
|
||||
<source>Repair</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> For begin diagnosticc enter please next line: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Drop</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fix failed ;( </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I know what I'm doing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -3,10 +3,6 @@
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>DoctorView</name>
|
||||
<message>
|
||||
<source>Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -27,5 +23,29 @@
|
||||
<source>Repair</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> For begin diagnosticc enter please next line: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Drop</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fix failed ;( </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I know what I'm doing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -3,10 +3,6 @@
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>DoctorView</name>
|
||||
<message>
|
||||
<source>Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -27,5 +23,29 @@
|
||||
<source>Repair</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> For begin diagnosticc enter please next line: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Drop</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fix failed ;( </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I know what I'm doing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -3,10 +3,6 @@
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>DoctorView</name>
|
||||
<message>
|
||||
<source>Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -27,5 +23,29 @@
|
||||
<source>Repair</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> For begin diagnosticc enter please next line: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Drop</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fix failed ;( </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I know what I'm doing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -3,10 +3,6 @@
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>DoctorView</name>
|
||||
<message>
|
||||
<source>Attention: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This is your personal application doctor room! The doctor automatically check your application to exits errors. If the Doctor found any errors he suggest solution of your issue</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -27,5 +23,29 @@
|
||||
<source>Repair</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><b>Attention</b>: Please use this page only if you knows what you do. If your application works correctly then please - do nothing.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> For begin diagnosticc enter please next line: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter: </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Drop</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Fix failed ;( </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>I know what I'm doing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -6,7 +6,7 @@
|
||||
//#
|
||||
|
||||
#include <QtTest>
|
||||
#include "exampletest.h"
|
||||
#include "basetest.h"
|
||||
|
||||
// Use This macros for initialize your own test classes.
|
||||
// Check exampletests
|
||||
@ -32,7 +32,7 @@ private slots:
|
||||
|
||||
|
||||
// BEGIN TESTS CASES
|
||||
TestCase(exampleTest, ExampleTest)
|
||||
TestCase(baseTest, BaseTest)
|
||||
// END TEST CASES
|
||||
|
||||
private:
|
||||
|
61
tests/units/basetest.cpp
Normal file
61
tests/units/basetest.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
//#
|
||||
//# Copyright (C) 2020-2022 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
|
||||
#include "basetest.h"
|
||||
|
||||
#include <DoctorPillCore/ipill.h>
|
||||
|
||||
class TestPill: public DP::iPill {
|
||||
|
||||
|
||||
// iPill interface
|
||||
public:
|
||||
TestPill(BaseTest* app) {
|
||||
_app = app;
|
||||
};
|
||||
|
||||
QString name() const override {
|
||||
return "Test pill";
|
||||
};
|
||||
|
||||
QString description() const override {
|
||||
return "just test pill";
|
||||
};
|
||||
|
||||
protected:
|
||||
bool diagnostic() const override {
|
||||
return _app->_appIsBroken;
|
||||
};
|
||||
|
||||
bool fix() const override {
|
||||
_app->_appIsBroken = false;
|
||||
return !_app->_appIsBroken;
|
||||
};
|
||||
|
||||
private:
|
||||
BaseTest * _app = nullptr;
|
||||
};
|
||||
|
||||
BaseTest::BaseTest() {
|
||||
|
||||
}
|
||||
|
||||
BaseTest::~BaseTest() {
|
||||
|
||||
}
|
||||
|
||||
void BaseTest::test() {
|
||||
|
||||
_appIsBroken = true;
|
||||
QVERIFY(_test.test({QSharedPointer<TestPill>::create(this)}, _appIsBroken));
|
||||
QVERIFY(!_appIsBroken);
|
||||
|
||||
QVERIFY(_test.test({QSharedPointer<TestPill>::create(this)}, _appIsBroken));
|
||||
QVERIFY(!_appIsBroken);
|
||||
|
||||
}
|
@ -6,21 +6,29 @@
|
||||
//#
|
||||
|
||||
|
||||
#ifndef EXAMPLE_TEST_H
|
||||
#define EXAMPLE_TEST_H
|
||||
#ifndef BASE_TEST_H
|
||||
#define BASE_TEST_H
|
||||
#include "test.h"
|
||||
#include "testutils.h"
|
||||
#include "DoctorPillCore/doctortest.h"
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
class ExampleTest: public Test, protected TestUtils
|
||||
class BaseTest: public Test, protected TestUtils
|
||||
{
|
||||
public:
|
||||
ExampleTest();
|
||||
~ExampleTest();
|
||||
BaseTest();
|
||||
~BaseTest();
|
||||
|
||||
void test();
|
||||
|
||||
private:
|
||||
DP::DoctorTest _test;
|
||||
|
||||
friend class TestPill;
|
||||
|
||||
bool _appIsBroken = true;
|
||||
|
||||
};
|
||||
|
||||
#endif // EXAMPLE_TEST_H
|
||||
#endif // BASE_TEST_H
|
@ -1,22 +0,0 @@
|
||||
//#
|
||||
//# Copyright (C) 2020-2022 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
|
||||
#include "exampletest.h"
|
||||
|
||||
|
||||
ExampleTest::ExampleTest() {
|
||||
|
||||
}
|
||||
|
||||
ExampleTest::~ExampleTest() {
|
||||
|
||||
}
|
||||
|
||||
void ExampleTest::test() {
|
||||
QVERIFY(true);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user