1
Diary of making test runner DLL resource safe.
3
Repeat everything, that was done for version 1.8.0. This is point 1) to 9).
5
0) With the unit-tests for the test runner DLL all four tests fail with the original
6
version 1.9.8 of CPP-Unit.
8
1) Replace the original integer dialog ids with new string ids
9
CPP_UNIT_TEST_RUNNER_IDD_DIALOG_TEST_HIERARCHY
10
CPP_UNIT_TEST_RUNNER_IDD_DIALOG_TESTRUNNER
11
Because these are not in resource.h VC++ interpretes these values
15
- Make a copy of the constructor and replace the integer id with a string id.
16
- Move the initialization code in the two constructors to the new private member
18
- Put an ASSERT in the old constructor.
19
- Remove the enum IDD=IDD_DIALOG_TESTRUNNER from the resource.h and TestRunnerDlg.h
20
header files. Accordingly remove the default value nDialogResourceId in the
21
constructor, that uses the integer id.
23
3) TreeHierarchyDlg.cpp:
24
- Replace the integer id in the call to the base class constructor with
26
- Remove the enum IDD=IDD_DIALOG_TEST_HIERARCHY from the resource.h and
27
TreeHierarchyDlg.h header file.
29
4) Test. Two of the four tests still fail. The remaining errors result from
30
the conflicts in the string table.
32
5) Since strings ids don't work for the string table I created the new function
33
loadCString to load the strings from the correct resource module which is of
34
course the test runner module. The new function is in the files
35
ResourceLoaders.[cpp|h] since I didn't find a good existing place. Baptiste,
36
if you know of a good existing place simply move the function and remove the
39
6) Check all occurences of the strings and replace the original string refernces
40
with the new function loadCString.
44
IDS_ERRORLIST_FAILED_CONDITION
45
IDS_ERRORLIST_LINE_NUMBER
46
IDS_ERRORLIST_FILE_NAME
48
7) Test. No more errors are found.
50
8) Change the two bitmaps that are used in the list and the tree to use
51
string ids instead of integer ids.
52
- First changed the unit test so that the originally incorrect behaviour
53
is shown. Inserted red circles in the bitmaps in the unit test.
54
Then added the new test checkListBitmaps() and changed checkBrowseDlg()
55
to let the user visually check, if the correct bitmaps are used.
56
This has to be done by the user visually, because I couldn't think of
57
an automatic test, that could be implemented easily.
58
The last test for the correct bitmaps will ALWAYS fail, so that the
59
bitmaps can be checked visually.
60
- Changed the RC-file of the test runner DLL:
61
CPP_UNIT_TEST_RUNNER_IDB_TEST_TYPE
62
CPP_UNIT_TEST_RUNNER_IDB_ERROR_TYPE
63
Removed the original string ids from resource.h and changed TreeHierarchyDlg.cpp
64
and TestRunnerDlg.cpp so that the new string ids are used.
67
9) Changed the TestPlugInRunner. I don't know, how I can test this and would
68
ask you Baptiste to check it or let me know, how I can check it.
70
- Change the dialog id to the string id
71
CPP_UNIT_TEST_RUNNER_PLUG_IN_IDD_TEST_PLUG_IN_RUNNER
72
^^^^^^^ => This is different from the string id used
73
in the test runner DLL!
74
- Removed the original integer id from resource.h and TestPlugInRunnerDlg.h.
75
- Changed the constructor in TestPlugInRunnerDlg.cpp to use the new string id.
76
- Replaced the integer id IDR_TEST_PLUGIN_RUNNER for the icon with the string
77
id CPP_UNIT_TEST_RUNNER_PLUG_IN_IDR_TEST_PLUGIN_RUNNER in the RC-file and in
78
the constructor TestPlugInRunnerDlg and removed the original id from resource.h.
81
Here start the changes, that were only needed for version 1.9.8.
83
10) TestRunner is OK now. But I saw, that TestPlugInRunner has now more
84
resources than in version 1.8.0. After looking at it more carefully
85
it turned out that the sources of the test runner DLL have been
86
included in the test plug-in runner. In version 1.8.0 the test runner
87
was used through the testrunner.dll. This means that some additional
88
changes have to be made to the test plug-in runner.
89
- Additionally changed IDD_DIALOG_TEST_HIERARCHY to
90
CPP_UNIT_TEST_RUNNER_IDD_DIALOG_TEST_HIERARCHY. This is the same
91
name as in the original test runner because the dialog is created
92
with the original code. I don't know how to check this, thus I'm
93
not sure wether this is OK.
94
- Replaced the ids for the bitmaps. Here the same applies as in the
95
previous point, I'm not sure, if it works.
96
- Include ResourceLoaders.cpp in the subproject
97
TestPlugInRunner/TestRunner-Was-In-Dll/UserInterface
98
- Removed the original #include "TestRunnerApp.h" in ResourceLoaders.cpp
100
extern HINSTANCE g_testRunnerResource;
102
HINSTANCE g_testRunnerResource;
103
in TestPlugInRunnerApp.cpp and set the variable in InitInstance() with
104
g_testRunnerResource = AfxGetResourceHandle();
105
- Replaced the integer id for the icon with a string id
106
m_hIcon = AfxGetApp()->LoadIcon("CPP_UNIT_TEST_RUNNER_PLUG_IN_IDR_TEST_PLUGIN_RUNNER");
107
in the constructor in TestPlugInRunnerDlg.cpp and in the RC-file.
b'\\ No newline at end of file'