From 2acafc8b0146d70cb19c61ed257b7fb0c4b569c1 Mon Sep 17 00:00:00 2001
From: loong ci <loong_c@yeah.net>
Date: Thu, 21 Jul 2022 14:51:55 +0800
Subject: [PATCH] fix function virtual

---
 tests/src/displaycontent_test.cpp | 20 ++++++++++----------
 tests/src/logfileparser_test.cpp  |  2 +-
 tests/src/stub.h                  |  4 ++--
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/src/displaycontent_test.cpp b/tests/src/displaycontent_test.cpp
index 374c914..010f229 100644
--- a/tests/src/displaycontent_test.cpp
+++ b/tests/src/displaycontent_test.cpp
@@ -95,7 +95,7 @@ TEST_F(DisplayContentlx_UT, exportClicked_UT)
     m_content->selectFilter = "TEXT (*.txt)";
     stub.set(ADDR(QStandardPaths, writableLocation), stub_writableLocation);
     stub.set(ADDR(QFileDialog, getSaveFileName), stub_getSaveFileName);
-    stub.set(ADDR(QThreadPool, start), stub_start);
+    stub.set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), stub_start);
     m_content->m_flag = LOG_FLAG::BOOT;
     m_content->slot_exportClicked();
     m_content->m_flag = LOG_FLAG::APP;
@@ -122,7 +122,7 @@ TEST_F(DisplayContentlx_UT, exportClicked_UT001)
     m_content->selectFilter = "Html (*.html)";
     stub.set(ADDR(QStandardPaths, writableLocation), stub_writableLocation);
     stub.set(ADDR(QFileDialog, getSaveFileName), stub_getSaveFileName);
-    stub.set(ADDR(QThreadPool, start), stub_start);
+    stub.set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), stub_start);
     m_content->m_flag = LOG_FLAG::BOOT;
     m_content->slot_exportClicked();
     m_content->m_flag = LOG_FLAG::APP;
@@ -149,7 +149,7 @@ TEST_F(DisplayContentlx_UT, exportClicked_UT002)
     m_content->selectFilter = "Doc (*.doc)";
     stub.set(ADDR(QStandardPaths, writableLocation), stub_writableLocation);
     stub.set(ADDR(QFileDialog, getSaveFileName), stub_getSaveFileName);
-    stub.set(ADDR(QThreadPool, start), stub_start);
+    stub.set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), stub_start);
     m_content->m_flag = LOG_FLAG::BOOT;
     m_content->slot_exportClicked();
     m_content->m_flag = LOG_FLAG::APP;
@@ -176,7 +176,7 @@ TEST_F(DisplayContentlx_UT, exportClicked_UT003)
     m_content->selectFilter = "Xls (*.xls)";
     stub.set(ADDR(QStandardPaths, writableLocation), stub_writableLocation);
     stub.set(ADDR(QFileDialog, getSaveFileName), stub_getSaveFileName);
-    stub.set(ADDR(QThreadPool, start), stub_start);
+    stub.set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), stub_start);
     m_content->m_flag = LOG_FLAG::BOOT;
     m_content->slot_exportClicked();
     m_content->m_flag = LOG_FLAG::APP;
@@ -203,7 +203,7 @@ TEST_F(DisplayContentlx_UT, exportClicked_UT004)
     m_content->selectFilter = "Xls (*.xls)";
     stub.set(ADDR(QStandardPaths, writableLocation), stub_writableLocation);
     stub.set(ADDR(QFileDialog, getSaveFileName), stub_getSaveFileName);
-    stub.set(ADDR(QThreadPool, start), stub_start);
+    stub.set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), stub_start);
     m_content->m_flag = LOG_FLAG::BOOT;
     m_content->slot_exportClicked();
     m_content->m_flag = LOG_FLAG::APP;
@@ -1223,7 +1223,7 @@ TEST(DisplayContent_slot_statusChagned_UT, DisplayContent_slot_statusChagned_UT_
     DisplayContent *p = new DisplayContent(nullptr);
     EXPECT_NE(p, nullptr);
     Stub stub;
-    stub.set(ADDR(QThreadPool, start), QThreadPool_start);
+    stub.set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), QThreadPool_start);
     stub.set(ADDR(QThread, start), QThread_start);
     p->slot_statusChagned("OK");
     p->deleteLater();
@@ -1232,7 +1232,7 @@ TEST(DisplayContent_slot_statusChagned_UT, DisplayContent_slot_statusChagned_UT_
 TEST(DisplayContent_slot_dpkgFinished_UT, DisplayContent_slot_dpkgFinished_UT_001)
 {
     Stub stub;
-    stub.set(ADDR(QThreadPool, start), QThreadPool_start);
+    stub.set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), QThreadPool_start);
     stub.set(ADDR(QThread, start), QThread_start);
     DisplayContent *p = new DisplayContent(nullptr);
     EXPECT_NE(p, nullptr);
@@ -1255,7 +1255,7 @@ TEST(DisplayContent_slot_dpkgFinished_UT, DisplayContent_slot_dpkgFinished_UT_00
 TEST(DisplayContent_slot_XorgFinished_UT, DisplayContent_slot_XorgFinished_UT_001)
 {
     Stub stub;
-    stub.set(ADDR(QThreadPool, start), QThreadPool_start);
+    stub.set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), QThreadPool_start);
     stub.set(ADDR(QThread, start), QThread_start);
     DisplayContent *p = new DisplayContent(nullptr);
     EXPECT_NE(p, nullptr);
@@ -1541,7 +1541,7 @@ TEST_P(DisplayContent_slot_vScrollValueChanged_UT, DisplayContent_slot_vScrollVa
     }
     Stub stub;
     stub.set(ADDR(LogTreeView, singleRowHeight), DisplayContent_slot_vScrollValueChanged_treeView_singleRowHeight_Func);
-    stub.set(ADDR(QThreadPool, start), QThreadPool_start);
+    stub.set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), QThreadPool_start);
     stub.set(ADDR(QThread, start), QThread_start);
     if (!param.isLastHeight) {
         p->m_treeViewLastScrollValue = valuePixel;
@@ -1688,7 +1688,7 @@ TEST_P(DisplayContent_slot_searchResult_UT, DisplayContent_slot_searchResult_UT_
     DisplayContent_slot_searchResult_QString_contains = param.isContains;
     Stub stub;
     stub.set((bool (QString::*)(const QString &, Qt::CaseSensitivity) const)ADDR(QString, contains), DisplayContent_slot_searchResult_QString_contains_Func);
-    stub.set(ADDR(QThreadPool, start), QThreadPool_start);
+    stub.set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), QThreadPool_start);
     stub.set(ADDR(QThread, start), QThread_start);
     QString searchstr = param.isSearchEmpty ? "" : "testsearchstr";
     p->slot_searchResult(searchstr);
diff --git a/tests/src/logfileparser_test.cpp b/tests/src/logfileparser_test.cpp
index 779645e..f251a1c 100644
--- a/tests/src/logfileparser_test.cpp
+++ b/tests/src/logfileparser_test.cpp
@@ -100,7 +100,7 @@ TEST(LogFileParser_Destructor_UT, LogFileParser_Destructor_UT)
 TEST(LogFileParser_parseByJournalBoot_UT, LogFileParser_parseByJournalBoot_UT)
 {
     Stub *stub = new Stub;
-    stub->set(ADDR(QThreadPool, start), QThreadPool_start);
+    stub->set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), QThreadPool_start);
     stub->set(ADDR(QThread, start), QThread_start);
     LogFileParser *p = new LogFileParser(nullptr);
     EXPECT_NE(p, nullptr);
diff --git a/tests/src/stub.h b/tests/src/stub.h
index 76d6606..772045e 100644
--- a/tests/src/stub.h
+++ b/tests/src/stub.h
@@ -37,8 +37,8 @@
     // br x9 
     // addr 
     #define REPLACE_FAR(t, fn, fn_stub)\
-        ((uint32_t*)fn)[0] = 0x58000040 | 9;\
-        ((uint32_t*)fn)[1] = 0xd61f0120 | (9 << 5);\
+        ((int*)fn)[0] = 0x58000040 | 9;\
+        ((int*)fn)[1] = 0xd61f0120 | (9 << 5);\
         *(long long *)(fn + 8) = (long long )fn_stub;\
         CACHEFLUSH((char *)fn, CODESIZE);
     #define REPLACE_NEAR(t, fn, fn_stub) REPLACE_FAR(t, fn, fn_stub)
-- 
2.20.1

