summaryrefslogtreecommitdiff
path: root/cppe/test/Common/TestCommon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cppe/test/Common/TestCommon.cpp')
-rwxr-xr-xcppe/test/Common/TestCommon.cpp50
1 files changed, 41 insertions, 9 deletions
diff --git a/cppe/test/Common/TestCommon.cpp b/cppe/test/Common/TestCommon.cpp
index 681e597b5fb..9355f900619 100755
--- a/cppe/test/Common/TestCommon.cpp
+++ b/cppe/test/Common/TestCommon.cpp
@@ -20,7 +20,7 @@ using namespace std;
class LoggerI : public Ice::Logger
{
public:
-
+
virtual void
print(const string& message)
{
@@ -29,8 +29,13 @@ public:
virtual void
trace(const string& category, const string& message)
- {
- string s = "[ ";
+ {
+ char buf[1024];
+ sprintf(buf, "%ld", GetTickCount());
+ string s = "[ ";
+ s += buf;
+ s += ' ';
+
if(!category.empty())
{
s += category + ": ";
@@ -70,7 +75,8 @@ class TestSuiteFailed
{
public:
};
-
+
+static FILE* _tprintfp = 0;
static HWND hEdit;
static HWND mainWnd;
static IceUtil::ThreadControl mainThread;
@@ -78,13 +84,20 @@ static IceUtil::ThreadControl mainThread;
void
tprintf(const char* fmt, ...)
{
-
va_list va;
va_start(va, fmt);
char buf[1024];
_vsnprintf(buf, sizeof(buf)-1, fmt, va);
buf[sizeof(buf)-1] = '\0';
- va_end(va);
+ va_end(va);
+
+ if(_tprintfp)
+ {
+ fwrite(buf, strlen(buf), 1, _tprintfp);
+ fflush(_tprintfp);
+ return;
+ }
+
char* start = buf;
const char* end = start + strlen(start);
char* curr = start;
@@ -226,8 +239,19 @@ TestApplication::main(HINSTANCE hInstance)
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
-
- mainWnd = CreateWindow(windowClassName, L"Test", WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_SIZEBOX,
+
+ wchar_t wName[1024] = L"Test";
+ if(_name.size() > 0)
+ {
+ int len = _name.size();
+ if(len > 1023)
+ {
+ len = 1023;
+ }
+ mbstowcs(wName, _name.c_str(), len);
+ wName[len] = L'\0';
+ }
+ mainWnd = CreateWindow(windowClassName, wName, WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_SIZEBOX,
CW_USEDEFAULT, CW_USEDEFAULT, 320, 200,
NULL, NULL, hInstance, NULL);
if(mainWnd == NULL)
@@ -367,12 +391,20 @@ TestApplication::main(int ac, char* av[])
return status;
}
#endif
+
+TestApplication::TestApplication(const std::string& name)
+ : _name(name)
+{
+
+}
void
TestApplication::setCommunicator(const Ice::CommunicatorPtr& communicator)
{
_communicator = communicator;
- _communicator->setLogger(new LoggerI);
+ _communicator->setLogger(new LoggerI);
+
+ //_tprintfp = fopen(("log-" + _name + ".txt").c_str(), "w");
}
Ice::CommunicatorPtr