]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/net/socket.cpp
using ordinary Show for popup windows as on MSW which activates it as well, I'll...
[wxWidgets.git] / tests / net / socket.cpp
index 5928915e410a556341833d6936a22e8e3b09f03c..3532618f8cfbc03ec3602b4b06f0756907874e2a 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      Vadim Zeitlin
 // RCS-ID:      $Id$
 // Copyright:   (c) 2008 Vadim Zeitlin
-// Licence:     wxWidgets licence
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 /*
@@ -68,17 +68,23 @@ private:
         {
             m_useLoop = useLoop;
             if ( useLoop )
+            {
+                m_evtLoopOld = wxEventLoopBase::GetActive();
                 SetActive(this);
+            }
         }
 
         virtual ~SocketTestEventLoop()
         {
             if ( m_useLoop )
-                SetActive(NULL);
+            {
+                wxEventLoopBase::SetActive(m_evtLoopOld);
+            }
         }
 
     private:
         bool m_useLoop;
+        wxEventLoopBase *m_evtLoopOld;
     };
 
     // get the address to connect to, if NULL is returned it means that the
@@ -180,6 +186,7 @@ void SocketTestCase::ReadNormal()
 
     CPPUNIT_ASSERT_EQUAL( wxSOCKET_NOERROR, sock->LastError() );
     CPPUNIT_ASSERT_EQUAL( WXSIZEOF(bufSmall), (size_t)sock->LastCount() );
+    CPPUNIT_ASSERT_EQUAL( WXSIZEOF(bufSmall), (size_t)sock->LastReadCount() );
 
 
     char bufBig[102400];
@@ -187,6 +194,7 @@ void SocketTestCase::ReadNormal()
 
     CPPUNIT_ASSERT_EQUAL( wxSOCKET_NOERROR, sock->LastError() );
     CPPUNIT_ASSERT( WXSIZEOF(bufBig) >= sock->LastCount() );
+    CPPUNIT_ASSERT( WXSIZEOF(bufBig) >= sock->LastReadCount() );
 }
 
 void SocketTestCase::ReadBlock()
@@ -200,6 +208,7 @@ void SocketTestCase::ReadBlock()
 
     CPPUNIT_ASSERT_EQUAL( wxSOCKET_NOERROR, sock->LastError() );
     CPPUNIT_ASSERT_EQUAL( WXSIZEOF(bufSmall), (size_t)sock->LastCount() );
+    CPPUNIT_ASSERT_EQUAL( WXSIZEOF(bufSmall), (size_t)sock->LastReadCount() );
 
 
     char bufBig[102400];
@@ -207,6 +216,7 @@ void SocketTestCase::ReadBlock()
 
     CPPUNIT_ASSERT_EQUAL( wxSOCKET_NOERROR, sock->LastError() );
     CPPUNIT_ASSERT( WXSIZEOF(bufBig) >= sock->LastCount() );
+    CPPUNIT_ASSERT( WXSIZEOF(bufBig) >= sock->LastReadCount() );
 }
 
 void SocketTestCase::ReadNowait()
@@ -236,6 +246,7 @@ void SocketTestCase::ReadWaitall()
 
     CPPUNIT_ASSERT_EQUAL( wxSOCKET_NOERROR, sock->LastError() );
     CPPUNIT_ASSERT_EQUAL( WXSIZEOF(buf), (size_t)sock->LastCount() );
+    CPPUNIT_ASSERT_EQUAL( WXSIZEOF(buf), (size_t)sock->LastReadCount() );
 }
 
 void SocketTestCase::UrlTest()