From fea047a1fe9e2154ec37579628dd9ad11fd8051e Mon Sep 17 00:00:00 2001 From: wangyixue Date: Wed, 1 Feb 2023 15:14:22 +0800 Subject: [PATCH] chore: correct some typos and improve log * Commond -> Command; * LOG_FLAG is a QString variable, cannot be surrounded by quotes; * initaalize -> initialize; * Initialize appenders first to get pretty print; * Remove some redundant quotes using qPrintable. Log: correct some typos and improve log --- src/common/performancemonitor.cpp | 18 +++++++++--------- src/editor/deletebackcommond.cpp | 16 ++++++++-------- src/editor/deletebackcommond.h | 12 ++++++------ src/editor/dtextedit.cpp | 32 ++++++++++++++++---------------- src/editor/indenttextcommond.cpp | 8 ++++---- src/editor/indenttextcommond.h | 12 ++++++------ src/editor/insertblockbytextcommond.cpp | 18 ++++++------------ src/editor/insertblockbytextcommond.h | 6 +++--- src/editor/replaceallcommond.cpp | 9 ++++----- src/editor/replaceallcommond.h | 6 +++--- src/main.cpp | 9 ++++----- tests/src/editor/ut_deletebackcommond.cpp | 16 ++++++++-------- tests/src/editor/ut_insertblockbytextcommond.cpp | 15 +++++++-------- tests/src/editor/ut_replaceallcommond.cpp | 9 ++++----- 14 files changed, 88 insertions(+), 98 deletions(-) diff --git a/src/common/performancemonitor.cpp b/src/common/performancemonitor.cpp index cdbf9df..f5fffbd 100644 --- a/src/common/performancemonitor.cpp +++ b/src/common/performancemonitor.cpp @@ -26,20 +26,20 @@ void PerformanceMonitor::initializeAppStart() { QDateTime current = QDateTime::currentDateTime(); - qDebug() << "LOG_FLAG" + qDebug() << qPrintable(LOG_FLAG) << QDateTime::currentDateTime().toString(Qt::ISODateWithMs) - << "start to initaalize app"; + << "start to initialize app"; initializeAppStartMs = current.toMSecsSinceEpoch(); } void PerformanceMonitor::initializAppFinish() { QDateTime current = QDateTime::currentDateTime(); - qDebug() << "LOG_FLAG" + qDebug() << qPrintable(LOG_FLAG) << QDateTime::currentDateTime().toString(Qt::ISODateWithMs) << " finish to initialize app"; inittalizeApoFinishMs = current.toMSecsSinceEpoch(); qint64 time = inittalizeApoFinishMs - initializeAppStartMs; - qInfo() << QString("%1 startduration=%2ms #(Init app time)").arg(GRAB_POINT_INIT_APP_TIME).arg(time); + qInfo() << qPrintable(QString("%1 startduration=%2ms #(Init app time)").arg(GRAB_POINT_INIT_APP_TIME).arg(time)); } @@ -53,17 +53,17 @@ void PerformanceMonitor::closeAPPFinish() { QDateTime current = QDateTime::currentDateTime(); - qDebug() << "LOG_FLAG" + qDebug() << qPrintable(LOG_FLAG) << QDateTime::currentDateTime().toString(Qt::ISODateWithMs) << " finish to close app"; closeAppFinishMs = current.toMSecsSinceEpoch(); qint64 time = closeAppFinishMs - closeAppStartMs; - qInfo() << QString("%1 closeduration=%2ms #(Close app time)").arg(GRAB_POINT_CLOSE_APP_TIME).arg(time); + qInfo() << qPrintable(QString("%1 closeduration=%2ms #(Close app time)").arg(GRAB_POINT_CLOSE_APP_TIME).arg(time)); } void PerformanceMonitor::openFileStart() { QDateTime current = QDateTime::currentDateTime(); - qDebug() << "LOG_FLAG" + qDebug() << qPrintable(LOG_FLAG) << QDateTime::currentDateTime().toString(Qt::ISODateWithMs) << "start to open file"; @@ -74,11 +74,11 @@ void PerformanceMonitor::openFileFinish(const QString &strFileName, qint64 iFile { QDateTime current = QDateTime::currentDateTime(); - qDebug() << "LOG_FLAG" + qDebug() << qPrintable(LOG_FLAG) << QDateTime::currentDateTime().toString(Qt::ISODateWithMs) << " finish to open file"; openFileFinishMs = current.toMSecsSinceEpoch(); qint64 time = openFileFinishMs - openFileStartMs; float fFilesize = iFileSize; - qInfo() << QString("%1 filename=%2 filezise=%3M opentime=%4ms #(Open file time)").arg(GRAB_POINT_OPEN_FILE_TIME).arg(strFileName).arg(QString::number(fFilesize/(1024*1024), 'f', 6)).arg(time); + qInfo() << qPrintable(QString("%1 filename=%2 filezise=%3M opentime=%4ms #(Open file time)").arg(GRAB_POINT_OPEN_FILE_TIME).arg(strFileName).arg(QString::number(fFilesize/(1024*1024), 'f', 6)).arg(time)); } diff --git a/src/editor/deletebackcommond.cpp b/src/editor/deletebackcommond.cpp index 030db8a..22437d5 100644 --- a/src/editor/deletebackcommond.cpp +++ b/src/editor/deletebackcommond.cpp @@ -6,5 +6,5 @@ #include -DeleteBackCommond::DeleteBackCommond(QTextCursor cursor, QPlainTextEdit *edit): +DeleteBackCommand::DeleteBackCommand(QTextCursor cursor, QPlainTextEdit *edit): m_cursor(cursor), m_edit(edit) @@ -15,10 +15,10 @@ DeleteBackCommond::DeleteBackCommond(QTextCursor cursor, QPlainTextEdit *edit): } -DeleteBackCommond::~DeleteBackCommond() +DeleteBackCommand::~DeleteBackCommand() { } -void DeleteBackCommond::undo() +void DeleteBackCommand::undo() { m_cursor.setPosition(m_insertPos); @@ -29,5 +29,5 @@ void DeleteBackCommond::undo() } -void DeleteBackCommond::redo() +void DeleteBackCommand::redo() { m_cursor.setPosition(m_delPos); @@ -39,5 +39,5 @@ void DeleteBackCommond::redo() } -DeleteBackAltCommond::DeleteBackAltCommond(QList &selections,QPlainTextEdit* edit): +DeleteBackAltCommand::DeleteBackAltCommand(QList &selections,QPlainTextEdit* edit): m_ColumnEditSelections(selections), m_edit(edit) @@ -69,10 +69,10 @@ DeleteBackAltCommond::DeleteBackAltCommond(QList &sel } -DeleteBackAltCommond::~DeleteBackAltCommond() +DeleteBackAltCommand::~DeleteBackAltCommand() { } -void DeleteBackAltCommond::undo() +void DeleteBackAltCommand::undo() { @@ -93,5 +93,5 @@ void DeleteBackAltCommond::undo() } -void DeleteBackAltCommond::redo() +void DeleteBackAltCommand::redo() { int size = m_deletions.size(); diff --git a/src/editor/deletebackcommond.h b/src/editor/deletebackcommond.h index 3dd4c78..db0e1e1 100644 --- a/src/editor/deletebackcommond.h +++ b/src/editor/deletebackcommond.h @@ -10,9 +10,9 @@ #include //向后删除单一文字或选中文字的撤销重做 -class DeleteBackCommond:public QUndoCommand +class DeleteBackCommand:public QUndoCommand { public: - DeleteBackCommond(QTextCursor cursor,QPlainTextEdit* edit); - virtual ~DeleteBackCommond(); + DeleteBackCommand(QTextCursor cursor,QPlainTextEdit* edit); + virtual ~DeleteBackCommand(); virtual void undo(); virtual void redo(); @@ -29,9 +29,9 @@ private: //列模式下向后删除的撤销重做 -class DeleteBackAltCommond:public QUndoCommand +class DeleteBackAltCommand:public QUndoCommand { public: - DeleteBackAltCommond(QList &selections,QPlainTextEdit* edit); - virtual ~DeleteBackAltCommond(); + DeleteBackAltCommand(QList &selections,QPlainTextEdit* edit); + virtual ~DeleteBackAltCommand(); virtual void undo(); virtual void redo(); diff --git a/src/editor/dtextedit.cpp b/src/editor/dtextedit.cpp index 17dd1a8..b108c62 100644 --- a/src/editor/dtextedit.cpp +++ b/src/editor/dtextedit.cpp @@ -1325,5 +1325,5 @@ void TextEdit::killLine() if (!cursor.selectedText().isEmpty()) { - DeleteBackCommond *com = new DeleteBackCommond(cursor, this); + DeleteBackCommand *com = new DeleteBackCommand(cursor, this); m_pUndoStack->push(com); } @@ -1349,5 +1349,5 @@ void TextEdit::killCurrentLine() } if (!cursor.selectedText().isEmpty()) { - DeleteBackCommond *com = new DeleteBackCommond(cursor, this); + DeleteBackCommand *com = new DeleteBackCommand(cursor, this); m_pUndoStack->push(com); } @@ -1405,5 +1405,5 @@ void TextEdit::indentText() //do the indent operation - auto com = new IndentTextCommond(this, pos1, pos2, line1, line2); + auto com = new IndentTextCommand(this, pos1, pos2, line1, line2); m_pUndoStack->push(com); } @@ -1419,5 +1419,5 @@ void TextEdit::unindentText() //the text in front of current line is '\t'. if ("\t" == cursor.selectedText()) { - DeleteBackCommond *com = new DeleteBackCommond(cursor, this); + DeleteBackCommand *com = new DeleteBackCommand(cursor, this); m_pUndoStack->push(com); } @@ -1433,5 +1433,5 @@ void TextEdit::unindentText() cursor.setPosition(startpos); cursor.setPosition(pos, QTextCursor::KeepAnchor); - DeleteBackCommond *com = new DeleteBackCommond(cursor, this); + DeleteBackCommand *com = new DeleteBackCommand(cursor, this); m_pUndoStack->push(com); @@ -1564,6 +1564,6 @@ void TextEdit::convertWordCase(ConvertCase convertCase) // 如果没有实际文本更改效果,不进行文本替换操作 if (text != textCursor().selectedText()) { - InsertTextUndoCommand *insertCommond = new InsertTextUndoCommand(textCursor(), text, this); - m_pUndoStack->push(insertCommond); + InsertTextUndoCommand *insertCommand = new InsertTextUndoCommand(textCursor(), text, this); + m_pUndoStack->push(insertCommand); } } else { @@ -1589,6 +1589,6 @@ void TextEdit::convertWordCase(ConvertCase convertCase) } - InsertTextUndoCommand *insertCommond = new InsertTextUndoCommand(cursor, text, this); - m_pUndoStack->push(insertCommond); + InsertTextUndoCommand *insertCommand = new InsertTextUndoCommand(cursor, text, this); + m_pUndoStack->push(insertCommand); setTextCursor(cursor); @@ -1722,5 +1722,5 @@ void TextEdit::replaceAll(const QString &replaceText, const QString &withText) ChangeMarkCommand *pChangeMark = new ChangeMarkCommand(this, backupMarkList, replaceList); // 设置替换撤销项为颜色标记变更撤销项的子项 - new ReplaceAllCommond(oldText, newText, cursor, pChangeMark); + new ReplaceAllCommand(oldText, newText, cursor, pChangeMark); m_pUndoStack->push(pChangeMark); } @@ -1860,5 +1860,5 @@ void TextEdit::replaceRest(const QString &replaceText, const QString &withText) ChangeMarkCommand *pChangeMark = new ChangeMarkCommand(this, backupMarkList, replaceList); // 设置替换撤销项为颜色标记变更撤销项的子项 - new ReplaceAllCommond(oldText, newText, cursor, pChangeMark); + new ReplaceAllCommand(oldText, newText, cursor, pChangeMark); m_pUndoStack->push(pChangeMark); } @@ -2627,5 +2627,5 @@ void TextEdit::paste() int size = text.size(); if (size > block) { - InsertBlockByTextCommond *commond = new InsertBlockByTextCommond(text, this, m_wrapper); + InsertBlockByTextCommand *commond = new InsertBlockByTextCommand(text, this, m_wrapper); m_pUndoStack->push(commond); } else { @@ -2928,5 +2928,5 @@ void TextEdit::moveText(int from, int to, const QString &text, bool copy) if (!copy) { cursor.setPosition(from + text.size(), QTextCursor::KeepAnchor); - delCommand = new DeleteBackCommond(cursor, this); + delCommand = new DeleteBackCommand(cursor, this); } @@ -6391,5 +6391,5 @@ void TextEdit::dropEvent(QDropEvent *event) cursor2.insertText(data->text()); cursor2.setPosition(cursor2.position() - data->text().size(), QTextCursor::KeepAnchor); - auto com2 = new DeleteBackCommond(cursor2, another); + auto com2 = new DeleteBackCommand(cursor2, another); another->m_pUndoStack->push(com2); } else if (!data->text().isEmpty()) { @@ -6929,5 +6929,5 @@ void TextEdit::keyPressEvent(QKeyEvent *e) if (m_bIsAltMod && !m_altModSelections.isEmpty()) { - DeleteBackAltCommond *commond = new DeleteBackAltCommond(m_altModSelections, this); + DeleteBackAltCommand *commond = new DeleteBackAltCommand(m_altModSelections, this); m_pUndoStack->push(commond); } else { @@ -6940,5 +6940,5 @@ void TextEdit::keyPressEvent(QKeyEvent *e) if (m_delText.size() <= 0) return; - DeleteBackCommond *commond = new DeleteBackCommond(cursor, this); + DeleteBackCommand *commond = new DeleteBackCommand(cursor, this); m_pUndoStack->push(commond); } diff --git a/src/editor/indenttextcommond.cpp b/src/editor/indenttextcommond.cpp index 9dd591a..eec4fe0 100644 --- a/src/editor/indenttextcommond.cpp +++ b/src/editor/indenttextcommond.cpp @@ -6,5 +6,5 @@ #include "dtextedit.h" -IndentTextCommond::IndentTextCommond(TextEdit* edit,int startpos,int endpos,int startline,int endline): +IndentTextCommand::IndentTextCommand(TextEdit* edit,int startpos,int endpos,int startline,int endline): m_edit(edit), m_startpos(startpos), @@ -15,10 +15,10 @@ IndentTextCommond::IndentTextCommond(TextEdit* edit,int startpos,int endpos,int m_hasselected = m_edit->textCursor().hasSelection(); } -IndentTextCommond::~IndentTextCommond() +IndentTextCommand::~IndentTextCommand() { } -void IndentTextCommond::redo() +void IndentTextCommand::redo() { auto cursor = m_edit->textCursor(); @@ -52,5 +52,5 @@ void IndentTextCommond::redo() -void IndentTextCommond::undo() +void IndentTextCommand::undo() { auto cursor = m_edit->textCursor(); diff --git a/src/editor/indenttextcommond.h b/src/editor/indenttextcommond.h index 5a3a6bb..1073042 100644 --- a/src/editor/indenttextcommond.h +++ b/src/editor/indenttextcommond.h @@ -3,6 +3,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef IndentTextCommond_H -#define IndentTextCommond_H +#ifndef IndentTextCommand_H +#define IndentTextCommand_H #include @@ -12,9 +12,9 @@ class TextEdit; //indent text in front of multiple lines -class IndentTextCommond:public QUndoCommand +class IndentTextCommand:public QUndoCommand { public: - IndentTextCommond(TextEdit* edit,int startpos,int endpos,int startline,int endline); - virtual ~IndentTextCommond(); + IndentTextCommand(TextEdit* edit,int startpos,int endpos,int startline,int endline); + virtual ~IndentTextCommand(); virtual void redo(); @@ -36,3 +36,3 @@ private: }; -#endif // IndentTextCommond_H +#endif // IndentTextCommand_H diff --git a/src/editor/insertblockbytextcommond.cpp b/src/editor/insertblockbytextcommond.cpp index 4a86458..f33971c 100644 --- a/src/editor/insertblockbytextcommond.cpp +++ b/src/editor/insertblockbytextcommond.cpp @@ -11,5 +11,5 @@ #include "../widgets/bottombar.h" -InsertBlockByTextCommond::InsertBlockByTextCommond(const QString &text,TextEdit *edit,EditWrapper* wrapper): +InsertBlockByTextCommand::InsertBlockByTextCommand(const QString &text,TextEdit *edit,EditWrapper* wrapper): m_text(text), m_edit(edit), @@ -26,17 +26,17 @@ InsertBlockByTextCommond::InsertBlockByTextCommond(const QString &text,TextEdit } -InsertBlockByTextCommond::~InsertBlockByTextCommond() +InsertBlockByTextCommand::~InsertBlockByTextCommand() { } -void InsertBlockByTextCommond::redo() +void InsertBlockByTextCommand::redo() { treat(true); insertByBlock(); treat(false); } -void InsertBlockByTextCommond::undo() +void InsertBlockByTextCommand::undo() { treat(true); @@ -55,5 +55,5 @@ void InsertBlockByTextCommond::undo() } -void InsertBlockByTextCommond::treat(bool isStart) +void InsertBlockByTextCommand::treat(bool isStart) { if(m_wrapper!=nullptr){ @@ -75,5 +75,5 @@ void InsertBlockByTextCommond::treat(bool isStart) } -void InsertBlockByTextCommond::insertByBlock() +void InsertBlockByTextCommand::insertByBlock() { auto cursor = m_edit->textCursor(); @@ -101,8 +101,2 @@ void InsertBlockByTextCommond::insertByBlock() m_delPos = cursor.position(); } - - - - - - diff --git a/src/editor/insertblockbytextcommond.h b/src/editor/insertblockbytextcommond.h index 81a18ff..ef13081 100644 --- a/src/editor/insertblockbytextcommond.h +++ b/src/editor/insertblockbytextcommond.h @@ -14,9 +14,9 @@ class EditWrapper; //分块插入文本-撤销重做 -class InsertBlockByTextCommond:public QUndoCommand +class InsertBlockByTextCommand:public QUndoCommand { public: - InsertBlockByTextCommond(const QString& text,TextEdit* edit,EditWrapper* wrapper); - virtual ~InsertBlockByTextCommond(); + InsertBlockByTextCommand(const QString& text,TextEdit* edit,EditWrapper* wrapper); + virtual ~InsertBlockByTextCommand(); virtual void redo(); diff --git a/src/editor/replaceallcommond.cpp b/src/editor/replaceallcommond.cpp index fa6dded..4aa0d85 100644 --- a/src/editor/replaceallcommond.cpp +++ b/src/editor/replaceallcommond.cpp @@ -7,5 +7,5 @@ -ReplaceAllCommond::ReplaceAllCommond(QString &oldText, QString &newText, QTextCursor cursor, QUndoCommand *parent) +ReplaceAllCommand::ReplaceAllCommand(QString &oldText, QString &newText, QTextCursor cursor, QUndoCommand *parent) : QUndoCommand(parent) , m_oldText(oldText) @@ -16,10 +16,10 @@ ReplaceAllCommond::ReplaceAllCommond(QString &oldText, QString &newText, QTextCu } -ReplaceAllCommond::~ReplaceAllCommond() +ReplaceAllCommand::~ReplaceAllCommand() { } -void ReplaceAllCommond::redo() +void ReplaceAllCommand::redo() { m_cursor.setPosition(0); @@ -30,5 +30,5 @@ void ReplaceAllCommond::redo() } -void ReplaceAllCommond::undo() +void ReplaceAllCommand::undo() { m_cursor.setPosition(0); @@ -38,3 +38,2 @@ void ReplaceAllCommond::undo() m_cursor.insertText(m_oldText); } - diff --git a/src/editor/replaceallcommond.h b/src/editor/replaceallcommond.h index cd4ff6b..9b9c69a 100644 --- a/src/editor/replaceallcommond.h +++ b/src/editor/replaceallcommond.h @@ -14,9 +14,9 @@ // 全部替换撤销-重做 -class ReplaceAllCommond: public QUndoCommand +class ReplaceAllCommand: public QUndoCommand { public: - ReplaceAllCommond(QString &oldText, QString &newText, QTextCursor cursor, QUndoCommand *parent = nullptr); - virtual ~ReplaceAllCommond(); + ReplaceAllCommand(QString &oldText, QString &newText, QTextCursor cursor, QUndoCommand *parent = nullptr); + virtual ~ReplaceAllCommand(); virtual void redo(); diff --git a/src/main.cpp b/src/main.cpp index 8d25bcb..68fab87 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,7 @@ DWIDGET_USE_NAMESPACE int main(int argc, char *argv[]) { - using namespace Dtk::Core; - + DCORE_USE_NAMESPACE + DLogManager::registerConsoleAppender(); + DLogManager::registerFileAppender(); PerformanceMonitor::initializeAppStart(); if (!QString(qgetenv("XDG_CURRENT_DESKTOP")).toLower().startsWith("deepin")) { @@ -44,6 +45,4 @@ int main(int argc, char *argv[]) EditorApplication app(argc, argv); - Dtk::Core::DLogManager::registerConsoleAppender(); - Dtk::Core::DLogManager::registerFileAppender(); // save theme DApplicationSettings savetheme; @@ -74,5 +73,5 @@ int main(int argc, char *argv[]) QJsonObject objStartEvent{ {"tid", Eventlogutils::StartUp}, - {"vsersion", VERSION}, + {"version", VERSION}, {"mode", 1}, }; diff --git a/tests/src/editor/ut_deletebackcommond.cpp b/tests/src/editor/ut_deletebackcommond.cpp index f2931ab..56452cd 100644 --- a/tests/src/editor/ut_deletebackcommond.cpp +++ b/tests/src/editor/ut_deletebackcommond.cpp @@ -13,9 +13,9 @@ UT_Deletebackcommond::UT_Deletebackcommond() } -TEST(UT_Deletebackcommond_DeleteBackCommond, UT_Deletebackcommond_DeleteBackCommond) +TEST(UT_Deletebackcommond_DeleteBackCommand, UT_Deletebackcommond_DeleteBackCommand) { QTextCursor cursor; QPlainTextEdit *pEdit = new QPlainTextEdit; - DeleteBackCommond *pCom = new DeleteBackCommond(cursor, pEdit); + DeleteBackCommand *pCom = new DeleteBackCommand(cursor, pEdit); ASSERT_TRUE(pCom->m_insertPos != 0); @@ -34,5 +34,5 @@ TEST(UT_Deletebackcommond_redo, UT_Deletebackcommond_redo) pWindow->currentWrapper()->textEditor()->insertPlainText(QString("12345")); cursor.setPosition(10, QTextCursor::MoveMode::KeepAnchor); - DeleteBackCommond *pCom = new DeleteBackCommond(cursor, pWindow->currentWrapper()->textEditor()); + DeleteBackCommand *pCom = new DeleteBackCommand(cursor, pWindow->currentWrapper()->textEditor()); pCom->m_delText = text; pCom->redo(); @@ -54,5 +54,5 @@ TEST(UT_Deletebackcommond_undo, UT_Deletebackcommond_undo) pWindow->currentWrapper()->textEditor()->insertPlainText(QString("12345")); cursor.setPosition(10, QTextCursor::MoveMode::KeepAnchor); - DeleteBackCommond *pCom = new DeleteBackCommond(cursor, pWindow->currentWrapper()->textEditor()); + DeleteBackCommand *pCom = new DeleteBackCommand(cursor, pWindow->currentWrapper()->textEditor()); pCom->m_delText = text; pCom->undo(); @@ -73,5 +73,5 @@ UT_Deletebackaltcommond::UT_Deletebackaltcommond() } -TEST(UT_Deletebackaltcommond_DeleteBackAltCommond, UT_Deletebackaltcommond_DeleteBackAltCommond) +TEST(UT_Deletebackaltcommond_DeleteBackAltCommand, UT_Deletebackaltcommond_DeleteBackAltCommand) { QString text = "test"; @@ -86,5 +86,5 @@ TEST(UT_Deletebackaltcommond_DeleteBackAltCommond, UT_Deletebackaltcommond_Delet QPlainTextEdit* edit = new QPlainTextEdit; - DeleteBackAltCommond* com = new DeleteBackAltCommond(list, edit); + DeleteBackAltCommand* com = new DeleteBackAltCommand(list, edit); delete com; @@ -109,5 +109,5 @@ TEST(UT_Deletebackaltcommond_redo, UT_Deletebackaltcommond_redo) list.push_back(sel); list.push_back(sel); - DeleteBackAltCommond * commond = new DeleteBackAltCommond(list,edit); + DeleteBackAltCommand * commond = new DeleteBackAltCommand(list,edit); commond->m_deletions = {{"123",1,1,1,cursor}}; commond->redo(); @@ -136,5 +136,5 @@ TEST(UT_Deletebackaltcommond_undo, UT_Deletebackaltcommond_undo) list.push_back(sel); - DeleteBackAltCommond* com = new DeleteBackAltCommond(list,edit); + DeleteBackAltCommand* com = new DeleteBackAltCommand(list,edit); com->m_deletions = {{"123",1,1,1,cursor}}; com->undo(); diff --git a/tests/src/editor/ut_insertblockbytextcommond.cpp b/tests/src/editor/ut_insertblockbytextcommond.cpp index 58cd5cf..6175243 100644 --- a/tests/src/editor/ut_insertblockbytextcommond.cpp +++ b/tests/src/editor/ut_insertblockbytextcommond.cpp @@ -27,5 +27,5 @@ test_insertblockbytextcommond::test_insertblockbytextcommond() } -TEST_F(test_insertblockbytextcommond, InsertBlockByTextCommond) +TEST_F(test_insertblockbytextcommond, InsertBlockByTextCommand) { Window *pWindow = new Window(); @@ -37,8 +37,8 @@ TEST_F(test_insertblockbytextcommond, InsertBlockByTextCommond) textCursor.movePosition(QTextCursor::Start, QTextCursor::KeepAnchor); pWindow->currentWrapper()->textEditor()->setTextCursor(textCursor); - InsertBlockByTextCommond *pInsertBlockByTextCommond = new InsertBlockByTextCommond(QString("Hei man"), + InsertBlockByTextCommand *pInsertBlockByTextCommand = new InsertBlockByTextCommand(QString("Hei man"), pWindow->currentWrapper()->textEditor(), pWindow->currentWrapper()); - QString strRet(pInsertBlockByTextCommond->m_selected); + QString strRet(pInsertBlockByTextCommand->m_selected); ASSERT_TRUE(!strRet.compare(QString("Holle world."))); @@ -57,5 +57,5 @@ TEST_F(test_insertblockbytextcommond, redo) TextEdit* edit = new TextEdit; edit->setTextCursor(cursor); - InsertBlockByTextCommond* com = new InsertBlockByTextCommond(text,edit,nullptr); + InsertBlockByTextCommand* com = new InsertBlockByTextCommand(text,edit,nullptr); com->redo(); @@ -79,5 +79,5 @@ TEST_F(test_insertblockbytextcommond, undo) TextEdit* edit = new TextEdit; edit->setTextCursor(cursor); - InsertBlockByTextCommond* com = new InsertBlockByTextCommond(text,edit,nullptr); + InsertBlockByTextCommand* com = new InsertBlockByTextCommand(text,edit,nullptr); com->undo(); @@ -104,5 +104,5 @@ TEST_F(test_insertblockbytextcommond, treat) // edit->m_wrapper = wrapper; // edit->setTextCursor(cursor); -// InsertBlockByTextCommond* com = new InsertBlockByTextCommond(text,edit,wrapper); +// InsertBlockByTextCommand* com = new InsertBlockByTextCommand(text,edit,wrapper); // Stub s1; @@ -131,5 +131,5 @@ TEST_F(test_insertblockbytextcommond, insertByBlock) TextEdit* edit = new TextEdit; edit->setTextCursor(cursor); - InsertBlockByTextCommond* com = new InsertBlockByTextCommond(text,edit,nullptr); + InsertBlockByTextCommand* com = new InsertBlockByTextCommand(text,edit,nullptr); com->insertByBlock(); @@ -140,3 +140,2 @@ TEST_F(test_insertblockbytextcommond, insertByBlock) edit->deleteLater(); } - diff --git a/tests/src/editor/ut_replaceallcommond.cpp b/tests/src/editor/ut_replaceallcommond.cpp index 79204ac..e38b533 100644 --- a/tests/src/editor/ut_replaceallcommond.cpp +++ b/tests/src/editor/ut_replaceallcommond.cpp @@ -11,9 +11,9 @@ test_replaceallcommond::test_replaceallcommond() } -TEST_F(test_replaceallcommond, ReplaceAllCommond) +TEST_F(test_replaceallcommond, ReplaceAllCommand) { QString text = "test"; QTextCursor cursor; - ReplaceAllCommond* com = new ReplaceAllCommond(text,text,cursor); + ReplaceAllCommand* com = new ReplaceAllCommand(text,text,cursor); ASSERT_TRUE(!text.compare(com->m_newText)); @@ -26,5 +26,5 @@ TEST_F(test_replaceallcommond, redo) QString text = "test"; QTextCursor cursor; - ReplaceAllCommond* com = new ReplaceAllCommond(text,text,cursor); + ReplaceAllCommand* com = new ReplaceAllCommand(text,text,cursor); com->redo(); ASSERT_TRUE(com->m_cursor.position() != 0); @@ -38,5 +38,5 @@ TEST_F(test_replaceallcommond, undo) QString text = "test"; QTextCursor cursor; - ReplaceAllCommond* com = new ReplaceAllCommond(text,text,cursor); + ReplaceAllCommand* com = new ReplaceAllCommand(text,text,cursor); com->undo(); ASSERT_TRUE(com->m_cursor.position() != 0); @@ -47,3 +47,2 @@ TEST_F(test_replaceallcommond, undo) } - -- libgit2 1.3.2