mirror of
https://gitee.com/jiuyilian/embedded-framework.git
synced 2025-01-06 10:16:51 -05:00
Backup.
This commit is contained in:
parent
0d8e8ce3c1
commit
a17cc5e307
|
@ -62,12 +62,6 @@ add_custom_target(
|
|||
-p ${PLATFORM_PATH}/cmake-shell
|
||||
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/application/HuntingCamera
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make HuntingCameraTest_code_check
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||
add_custom_target(
|
||||
|
|
|
@ -53,12 +53,6 @@ add_custom_target(
|
|||
-p ${PLATFORM_PATH}/cmake-shell
|
||||
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/middleware/AppManager
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make AppManagerTest_code_check
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||
add_custom_target(
|
||||
|
|
|
@ -50,12 +50,6 @@ add_custom_target(
|
|||
-p ${PLATFORM_PATH}/cmake-shell
|
||||
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/middleware/HuntingUpgrade
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make HuntingUpgradeTest_code_check
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||
add_custom_target(
|
||||
|
|
|
@ -51,12 +51,6 @@ add_custom_target(
|
|||
-p ${PLATFORM_PATH}/cmake-shell
|
||||
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/middleware/IpcConfig
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make IpcConfigTest_code_check
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||
add_custom_target(
|
||||
|
|
|
@ -59,12 +59,6 @@ add_custom_target(
|
|||
-p ${PLATFORM_PATH}/cmake-shell
|
||||
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/middleware/McuManager
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make McuManagerTest_code_check
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||
add_custom_target(
|
||||
|
|
|
@ -52,12 +52,6 @@ add_custom_target(
|
|||
-p ${PLATFORM_PATH}/cmake-shell
|
||||
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/middleware/MediaManager
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
PRE_BUILD
|
||||
COMMAND make MediaManagerTest_code_check
|
||||
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||
add_custom_target(
|
||||
|
|
49
test/middleware/MediaManager/src/MediaManagerTest.cpp
Normal file
49
test/middleware/MediaManager/src/MediaManagerTest.cpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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 "MediaManagerTest.h"
|
||||
void MediaManagerTest::SetUpTestCase()
|
||||
{
|
||||
CreateLogModule();
|
||||
ILogInit(LOG_INSTANCE_TYPE_END);
|
||||
}
|
||||
void MediaManagerTest::TearDownTestCase()
|
||||
{
|
||||
ILogUnInit();
|
||||
}
|
||||
void MediaManagerTest::SetUp()
|
||||
{
|
||||
CreateAllCamerasMcok();
|
||||
HalTestTool::Init();
|
||||
MediaManagerTestTool::Init();
|
||||
CreateHalCppModule();
|
||||
CreateMediaManagerModule();
|
||||
}
|
||||
void MediaManagerTest::TearDown()
|
||||
{
|
||||
MediaManagerTestTool::UnInit();
|
||||
HalTestTool::UnInit();
|
||||
DestroyMediaManagerModule();
|
||||
DestroyHalCppModule();
|
||||
DestroyAllCamerasMock();
|
||||
}
|
||||
void MediaManagerTest::CreateAllCamerasMcok(void)
|
||||
{
|
||||
std::shared_ptr<VCameraHal> camera = HalTestTool::MakeCameraHalTest(CameraType::MAIN_CAMERA);
|
||||
mAllCamerasMock[CameraType::MAIN_CAMERA] = camera;
|
||||
}
|
||||
void MediaManagerTest::DestroyAllCamerasMock(void)
|
||||
{
|
||||
mAllCamerasMock.clear();
|
||||
}
|
46
test/middleware/MediaManager/src/MediaManagerTest.h
Normal file
46
test/middleware/MediaManager/src/MediaManagerTest.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef MEDIA_MANAGER_TEST_H
|
||||
#define MEDIA_MANAGER_TEST_H
|
||||
#include "GtestUsing.h"
|
||||
#include "HalTestTool.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "MediaManagerTestTool.h"
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <thread>
|
||||
class MediaManagerTest : public testing::Test, public MediaManagerTestTool, public HalTestTool
|
||||
{
|
||||
public:
|
||||
MediaManagerTest()
|
||||
{
|
||||
}
|
||||
virtual ~MediaManagerTest()
|
||||
{
|
||||
}
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
|
||||
private:
|
||||
void CreateAllCamerasMcok(void);
|
||||
void DestroyAllCamerasMock(void);
|
||||
|
||||
protected:
|
||||
std::map<CameraType, std::shared_ptr<VCameraHal>> mAllCamerasMock;
|
||||
};
|
||||
#endif
|
|
@ -16,62 +16,13 @@
|
|||
#include "HalTestTool.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaManager.h"
|
||||
#include "MediaManagerTest.h"
|
||||
#include "MediaManagerTestTool.h"
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <thread>
|
||||
namespace MediaManagerTest
|
||||
namespace MediaManager_Test
|
||||
{
|
||||
class MediaManagerTest : public testing::Test, public MediaManagerTestTool, public HalTestTool
|
||||
{
|
||||
public:
|
||||
MediaManagerTest()
|
||||
{
|
||||
}
|
||||
virtual ~MediaManagerTest()
|
||||
{
|
||||
}
|
||||
static void SetUpTestCase()
|
||||
{
|
||||
CreateLogModule();
|
||||
ILogInit(LOG_INSTANCE_TYPE_END);
|
||||
}
|
||||
static void TearDownTestCase()
|
||||
{
|
||||
ILogUnInit();
|
||||
}
|
||||
virtual void SetUp()
|
||||
{
|
||||
CreateAllCamerasMcok();
|
||||
HalTestTool::Init();
|
||||
MediaManagerTestTool::Init();
|
||||
CreateHalCppModule();
|
||||
CreateMediaManagerModule();
|
||||
}
|
||||
virtual void TearDown()
|
||||
{
|
||||
MediaManagerTestTool::UnInit();
|
||||
HalTestTool::UnInit();
|
||||
DestroyMediaManagerModule();
|
||||
DestroyHalCppModule();
|
||||
DestroyAllCamerasMock();
|
||||
}
|
||||
|
||||
private:
|
||||
void CreateAllCamerasMcok(void)
|
||||
{
|
||||
std::shared_ptr<VCameraHal> camera = HalTestTool::MakeCameraHalTest(CameraType::MAIN_CAMERA);
|
||||
mAllCamerasMock[CameraType::MAIN_CAMERA] = camera;
|
||||
}
|
||||
void DestroyAllCamerasMock(void)
|
||||
{
|
||||
mAllCamerasMock.clear();
|
||||
}
|
||||
|
||||
protected:
|
||||
// const AppParam mAppParam;
|
||||
std::map<CameraType, std::shared_ptr<VCameraHal>> mAllCamerasMock;
|
||||
};
|
||||
// ../output_files/test/bin/MediaManagerTest --gtest_filter=MediaManagerTest.INTEGRATION_MediaManager_EXAMPLE_Demo0
|
||||
TEST_F(MediaManagerTest, INTEGRATION_MediaManager_EXAMPLE_Demo0)
|
||||
{
|
||||
|
@ -81,11 +32,6 @@ TEST_F(MediaManagerTest, INTEGRATION_MediaManager_EXAMPLE_Demo0)
|
|||
IMediaManager::GetInstance()->SetMediaMonitor(monitor);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
MockReportCameraEvent("test name", CameraType::MAIN_CAMERA);
|
||||
// MockAppClientConnect();
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
// MockSetRecordingStatus(RecordingStatus::RECORDING_START);
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
// IAppManager::GetInstance()->UnInit();
|
||||
IMediaManager::GetInstance()->UnInit();
|
||||
}
|
||||
} // namespace MediaManagerTest
|
||||
} // namespace MediaManager_Test
|
|
@ -14,16 +14,16 @@
|
|||
*/
|
||||
#include "MediaManagerMock.h"
|
||||
#include "ILog.h"
|
||||
StatusCode MediaManagerTest::SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor)
|
||||
StatusCode MediaManagerMockBase::SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor)
|
||||
{
|
||||
LogInfo("MediaManagerTest::SetMediaMonitor\n");
|
||||
LogInfo("MediaManagerMockBase::SetMediaMonitor\n");
|
||||
StatusCode code = SetMediaMonitorTrace(monitor);
|
||||
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||
return MediaManagerImpl::SetMediaMonitor(monitor);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
const StatusCode MediaManagerTest::SetMediaMonitorTrace(std::shared_ptr<VMediaMonitor> &monitor)
|
||||
const StatusCode MediaManagerMockBase::SetMediaMonitorTrace(std::shared_ptr<VMediaMonitor> &monitor)
|
||||
{
|
||||
LogInfo("SetMediaMonitorTrace::SetMediaMonitorTrace\n");
|
||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||
|
|
|
@ -16,18 +16,17 @@
|
|||
#define MEDIA_MANAGER_MOCK_H
|
||||
#include "MediaManagerImpl.h"
|
||||
#include "MediaManagerTestTool.h"
|
||||
class MediaManagerTest : public MediaManagerImpl
|
||||
class MediaManagerMockBase : public MediaManagerImpl
|
||||
{
|
||||
public:
|
||||
MediaManagerTest() = default;
|
||||
virtual ~MediaManagerTest() = default;
|
||||
// const StatusCode SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor) override;
|
||||
MediaManagerMockBase() = default;
|
||||
virtual ~MediaManagerMockBase() = default;
|
||||
StatusCode SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor) override;
|
||||
|
||||
protected:
|
||||
virtual const StatusCode SetMediaMonitorTrace(std::shared_ptr<VMediaMonitor> &monitor);
|
||||
};
|
||||
class MediaManagerMock : public MediaManagerTest
|
||||
class MediaManagerMock : public MediaManagerMockBase
|
||||
{
|
||||
public:
|
||||
MediaManagerMock() = default;
|
||||
|
|
|
@ -14,8 +14,13 @@
|
|||
*/
|
||||
#include "IMediaBase.h"
|
||||
#include "ILog.h"
|
||||
#include "MediaBase.h"
|
||||
#include "MediaBaseMakePtr.h"
|
||||
#include "StatusCode.h"
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
StatusCode IMediaBase::StartReadFile(const std::string &path)
|
||||
{
|
||||
LogWarning("STATUS_CODE_VIRTUAL_FUNCTION\n");
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
#include "MediaBase.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaBase.h"
|
||||
#include "StatusCode.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
void *ICreateMediaBase(const MediaHandleType type)
|
||||
{
|
||||
return NewIMediaBase(type);
|
||||
|
|
|
@ -14,12 +14,17 @@
|
|||
*/
|
||||
#include "MediaBaseImpl.h"
|
||||
#include "ILog.h"
|
||||
#include "StatusCode.h"
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <libavcodec/avcodec.h>
|
||||
// #include <libavcodec/avcodec.h>
|
||||
#include <libavcodec/packet.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libswscale/swscale.h>
|
||||
#include <libavutil/avutil.h>
|
||||
// #include <libswscale/swscale.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -32,6 +37,12 @@ StatusCode MediaBaseImpl::StartReadFile(const std::string &path)
|
|||
LogError("Couldn't open file: %s, result=%d\n", path.c_str(), result);
|
||||
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||
}
|
||||
// LogInfo("File: %s\n", pFormatCtx->filename);
|
||||
// LogInfo("File format: %s\n", pFormatCtx->iformat->name);
|
||||
// LogInfo("Duration: %ld\n", pFormatCtx->duration);
|
||||
// for (int i = 0; i < pFormatCtx->nb_streams; i++) {
|
||||
// LogInfo("stream codec_type = %d\n", pFormatCtx->streams[i]->codecpar->codec_type);
|
||||
// }
|
||||
if (avformat_find_stream_info(pFormatCtx, nullptr) < 0) {
|
||||
LogError("Couldn't find stream information.\n");
|
||||
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
*/
|
||||
#include "MediaBaseMakePtr.h"
|
||||
#include "ILog.h"
|
||||
#include "IMediaBase.h"
|
||||
#include "MediaBaseImpl.h"
|
||||
#include <memory>
|
||||
std::shared_ptr<MediaBaseMakePtr> &MediaBaseMakePtr::GetInstance(std::shared_ptr<MediaBaseMakePtr> *impl)
|
||||
{
|
||||
static auto instance = std::make_shared<MediaBaseMakePtr>();
|
||||
|
|
Loading…
Reference in New Issue
Block a user