diff options
author | Matthew Newhook <matthew@zeroc.com> | 2005-06-14 08:40:08 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2005-06-14 08:40:08 +0000 |
commit | 5db16cc54e96d51f8f47a4055ccc8c242ec76b6a (patch) | |
tree | d308e88d548edf54144853566574a2d1a9496e50 /cppe/test/Common/TestCommon.cpp | |
parent | Fixed bug in application update code. (diff) | |
download | ice-5db16cc54e96d51f8f47a4055ccc8c242ec76b6a.tar.bz2 ice-5db16cc54e96d51f8f47a4055ccc8c242ec76b6a.tar.xz ice-5db16cc54e96d51f8f47a4055ccc8c242ec76b6a.zip |
Fixed problem with write timeout detection under CE.
Diffstat (limited to 'cppe/test/Common/TestCommon.cpp')
-rwxr-xr-x | cppe/test/Common/TestCommon.cpp | 50 |
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 |