source: dev/branches/egtra/ab5.0/abdev/ab-test/ab-test.cpp@ 781

Last change on this file since 781 was 781, checked in by イグトランス (egtra), 13 years ago

abdev新ソース用プロジェクトabdev-implとAB全体の単体テスト用プロジェクトab-testの追加。LoadIcon代替関数の作成(テスト未記述)。

File size: 1.3 KB
Line 
1#include "stdafx.h"
2
3#include <GdiPlus.h>
4
5#define BOOST_TEST_MAIN
6
7#include <boost/test/unit_test.hpp>
8
9#include <Resource/Load.h>
10
11#include <res/resource.h>
12
13namespace fs = boost::filesystem;
14
15namespace abres = ActiveBasic::Resource;
16
17struct HModuleDeleter
18{
19 typedef HMODULE pointer;
20
21 void operator ()(pointer hmod) const
22 {
23 ::FreeLibrary(hmod);
24 }
25};
26
27typedef std::unique_ptr<HMODULE, HModuleDeleter> UniqueHModule;
28
29bool IconEquals(HICON hiconL, HICON hiconR)
30{
31 return false;
32}
33
34BOOST_AUTO_TEST_CASE( ResourceLoading )
35{
36 TCHAR moduleName[MAX_PATH];
37 ::GetModuleFileName(nullptr, moduleName, MAX_PATH);
38
39 auto systemDir = fs::path(moduleName).parent_path().parent_path() / "build/release/system";
40
41 UniqueHModule hmodRes(::LoadLibraryExW((systemDir / "res.dll").wstring().c_str(), nullptr, LOAD_LIBRARY_AS_DATAFILE));
42 BOOST_CHECK(hmodRes != nullptr);
43
44 auto hBasicProgramIconTarget = (HICON)LoadImage(hmodRes.get(), MAKEINTRESOURCE(IDI_BASICPROGRAM), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
45 auto hBasicProgramIcon = abres::LoadIcon(hmodRes.get(), IDI_BASICPROGRAM, 16, 16, LR_DEFAULTCOLOR);
46
47 BOOST_CHECK(hBasicProgramIconTarget != nullptr);
48 BOOST_CHECK(hBasicProgramIcon != nullptr);
49
50 BOOST_CHECK(IconEquals(hBasicProgramIconTarget, hBasicProgramIcon));
51
52}
Note: See TracBrowser for help on using the repository browser.