/* * Copyright (c) 2023 Fancy Code. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "HuntingCameraTest.h" #include "GtestUsing.h" #include "ILog.h" #include "MainThread.h" #include void MainThreadTest::CustomizationInit(void) { // Do nothing here to make sure test tool work. } HuntingCameraTest::HuntingCameraTest() { } HuntingCameraTest::~HuntingCameraTest() { } void HuntingCameraTest::SetUpTestCase() { CreateLogModule(); ILogInit(LOG_INSTANCE_TYPE_END); } void HuntingCameraTest::TearDownTestCase() { ILogUnInit(); } void HuntingCameraTest::SetUp() { CreateAllCamerasMcok(); std::shared_ptr mainThread = std::make_shared(); MainThread::GetInstance(&mainThread); HalTestTool::Init(); AppManagerTestTool::Init(); MissionManagerTestTool::Init(); mLinuxTest = LinuxTest::CreateLinuxTest(); std::shared_ptr test = mLinuxTest; LinuxApiMock::GetInstance(&test); LinuxApiMock::GetInstance()->Init(); McuManagerTestTool::Init(mLinuxTest); HalTestTool::InitSdCardHal(mLinuxTest); TestManager::Init(); } void HuntingCameraTest::TearDown() { TestManager::UnInit(); MissionManagerTestTool::UnInit(); AppManagerTestTool::UnInit(); HalTestTool::UnInit(); LinuxApiMock::GetInstance()->UnInit(); mLinuxTest = std::make_shared(); std::shared_ptr test = std::make_shared(); LinuxApiMock::GetInstance(&test); McuManagerTestTool::UnInit(); MainThread::GetInstance()->UnInit(); std::shared_ptr mainThread = std::make_shared(); MainThread::GetInstance(&mainThread); DestroyAllCamerasMock(); } void HuntingCameraTest::CreateAllCamerasMcok(void) { std::shared_ptr camera = HalTestTool::MakeCameraHalTest(CameraType::MAIN_CAMERA); mAllCamerasMock[CameraType::MAIN_CAMERA] = camera; } void HuntingCameraTest::DestroyAllCamerasMock(void) { mAllCamerasMock.clear(); }