Fixed:format bug.

This commit is contained in:
Fancy code 2024-07-16 23:42:08 +08:00
parent 547888643f
commit 49d3a9e7c7
2 changed files with 20 additions and 1 deletions

View File

@ -36,6 +36,7 @@ TestMissionState::TestMissionState() : MissionState("TestMissionState"), mFormat
}
void TestMissionState::GoInState()
{
mFormattingSDCard = false;
MissionState::GoInState();
LogInfo(" ========== TestMissionState::GoInState.\n");
AppParam mAppParam(APP_MANAGER_DEVICE_IP, APP_MANAGER_HTTP_SERVER_PORT, APP_MANAGER_TCP_SERVER_PORT); // TODO:
@ -93,7 +94,7 @@ bool TestMissionState::HoldDownFormatKey(const KeyEventData &data)
}
bool TestMissionState::HoldUpFormatKey(const KeyEventData &data)
{
mFormattingSDCard = false;
// mFormattingSDCard = false;
return EXECUTED;
}
SdCardStatus TestMissionState::SdCardStatusConvert(const StorageEvent &event)

View File

@ -81,6 +81,24 @@ TEST_F(HuntingCameraTest, HS_INTEGRATION_HunttingCamera_EXAMPLE_FormatSDCard)
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MainThread::GetInstance()->Runing();
}
/**
* @brief Construct a new test f object
* ../output_files/test/bin/HuntingCameraTest
* --gtest_filter=HuntingCameraTest.HS_INTEGRATION_HunttingCamera_EXAMPLE_FormatSDCard_Twice
*/
TEST_F(HuntingCameraTest, HS_INTEGRATION_HunttingCamera_EXAMPLE_FormatSDCard_Twice)
{
SetAllCamerasResult(mAllCamerasMock);
MockOtherSideIpcMissionReply(IpcMission::TEST);
MockSdCardFormatReturn(mLinuxTest, FORMAT_SD_CARD_SUCESS);
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 40);
HalTestTool::MockKeyClick("format", 1000 * 16); // Simulate pressing a button.
std::this_thread::sleep_for(std::chrono::milliseconds(1000 * 17));
HalTestTool::MockKeyClick("format", 1000 * 16); // Simulate pressing a button.
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MainThread::GetInstance()->Runing();
}
/**
* @brief Construct a new test f object
* ../output_files/test/bin/HuntingCameraTest