📄 test_bitmapfile.cpp
字号:
// Test_BitmapFile.cpp: implementation of the CTest_BitmapFile class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Test_BitmapFile.h"
#include "BitmapFile.h"
#ifdef TEST_CASE_CODE
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
BASE_TEST_CASE_CPP(CTest_BitmapFile)
BEGIN_TEST_CASE_MAP(CTest_BitmapFile)
TEST_CASE_MEMBER(test_LoadFile)
TEST_CASE_MEMBER(test_saveBitmap)
END_TEST_CASE_MAP
void CTest_BitmapFile::test_saveBitmap()
{
TEST_CASE_TRACE("Begin");
TEST_CASE_TRACE("Create a white bmp file");
CBitmapFile bitMapFle;
TCHAR szApPath [MAX_PATH] = {0};
GetModuleFileName(NULL,szApPath,MAX_PATH);
ASSERT(szApPath);
CString strPath(szApPath);
strPath.Replace("image.exe","sample_Ex.bmp");
TEST_CASE_TRACE("save white file to sample_Ex.bmp");
TEST_CASE_ASSERT(bitMapFle.SaveBitmap(strPath));
TEST_CASE_TRACE("End");
}
void CTest_BitmapFile::test_LoadFile()
{
TEST_CASE_TRACE("Begin");
CBitmapFile bitMapFle;
TCHAR szApPath [MAX_PATH] = {0};
GetModuleFileName(NULL,szApPath,MAX_PATH);
ASSERT(szApPath);
CString strPath(szApPath);
strPath.Replace("image.exe","sample.bmp");
TEST_CASE_TRACE("defining a CBitmapFile Object");
TEST_CASE_TRACE("Load File:");
TEST_CASE_TRACE(strPath);
if(bitMapFle.LoadBitmap(strPath))
{
TEST_CASE_TRACE("Load file ok");
int nHeight = bitMapFle.GetHeight();
int nWidth = bitMapFle.GetWidth();
TEST_CASE_TRACE("Image file info");
char szInfo[MAX_PATH];
wsprintf(szInfo,"Height = %d ,Width = %d ",nHeight,nWidth);
TEST_CASE_TRACE(szInfo);
}
else
TEST_CASE_TRACE("Load file error");
strPath.Empty();
TEST_CASE_TRACE("Test Load a Empty file");
TEST_CASE_ASSERT(bitMapFle.LoadBitmap(strPath));
TEST_CASE_TRACE("End");
}
CTest_BitmapFile::CTest_BitmapFile()
{
}
CTest_BitmapFile::~CTest_BitmapFile()
{
}
#endif //#ifdef TEST_CASE_CODE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -