home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK11 / MFC / SAMPLES / TESTSERV / TESTS.CP$ / tests
Encoding:
Text File  |  1992-03-19  |  3.6 KB  |  179 lines

  1. // tests.cpp : This file contains code which implements the test routines
  2. // specific to the Test Server application.
  3. //
  4. // This is a part of the Microsoft Foundation Classes C++ library.
  5. // Copyright (C) 1992 Microsoft Corporation
  6. // All rights reserved.
  7. //
  8. // This source code is only intended as a supplement to the
  9. // Microsoft Foundation Classes Reference and Microsoft
  10. // QuickHelp documentation provided with the library.
  11. // See these sources for detailed information regarding the
  12. // Microsoft Foundation Classes product.
  13.  
  14. #include "testserv.h"
  15.  
  16.  
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CTestServer::OnRevokeServerApi()
  20. //
  21. void CTestServer::OnRevokeServerApi()
  22. {
  23.     ASSERT (m_pServer != NULL);
  24.  
  25.     TRY
  26.     {
  27.         m_pServer->BeginRevoke();
  28.     }
  29.     CATCH(CException, e)
  30.     {
  31.         MessageBox("An exception was thrown during this operation.  "
  32.             "Please exit Test Server.", "Test Server", MB_ICONINFORMATION);
  33.         return;
  34.     }
  35.     END_CATCH
  36. }
  37.  
  38.  
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CTestServer::OnRevokeDocApi()
  42. //
  43. void CTestServer::OnRevokeDocApi()
  44. {
  45.     ASSERT (m_pDoc != NULL);
  46.  
  47.     TRY
  48.     {
  49.         m_pDoc->Revoke();
  50.         PostQuitMessage(0);
  51.     }
  52.     CATCH(CException, e)
  53.     {
  54.         MessageBox("An exception was thrown during this operation.  "
  55.             "Please exit Test Server.", "Test Server", MB_ICONINFORMATION);
  56.         return;
  57.     }
  58.     END_CATCH
  59. }
  60.  
  61.  
  62.  
  63. /////////////////////////////////////////////////////////////////////////////
  64. // CTestServer::OnRevertDocApi()
  65. //
  66. void CTestServer::OnRevertDocApi()
  67. {
  68.     ASSERT (m_pDoc != NULL);
  69.  
  70.     TRY
  71.     {
  72.         m_pDoc->NotifyRevert();
  73.     }
  74.     CATCH(CException, e)
  75.     {
  76.         MessageBox("An exception was thrown during this operation.  "
  77.             "Please exit Test Server.", "Test Server", MB_ICONINFORMATION);
  78.         return;
  79.     }
  80.     END_CATCH
  81. }
  82.  
  83.  
  84.  
  85.  
  86. /////////////////////////////////////////////////////////////////////////////
  87. // CTestServer::OnSaveDocApi()
  88. //
  89. void CTestServer::OnSaveDocApi()
  90. {
  91.     ASSERT (m_pDoc != NULL);
  92.  
  93.     TRY
  94.     {
  95.         m_pDoc->NotifySaved();
  96.     }
  97.     CATCH(CException, e)
  98.     {
  99.         MessageBox("An exception was thrown during this operation.  "
  100.             "Please exit Test Server.", "Test Server", MB_ICONINFORMATION);
  101.         return;
  102.     }
  103.     END_CATCH
  104. }
  105.  
  106.  
  107.  
  108.  
  109. /////////////////////////////////////////////////////////////////////////////
  110. // CTestServer::OnCloseDocApi()
  111. //
  112. void CTestServer::OnCloseDocApi()
  113. {
  114.     ASSERT (m_pDoc != NULL);
  115.  
  116.     TRY
  117.     {
  118.         m_pDoc->NotifyClosed();
  119.     }
  120.     CATCH(CException, e)
  121.     {
  122.         MessageBox("An exception was thrown during this operation.  "
  123.             "Please exit Test Server.", "Test Server", MB_ICONINFORMATION);
  124.         return;
  125.     }
  126.     END_CATCH
  127. }
  128.  
  129.  
  130.  
  131.  
  132. /////////////////////////////////////////////////////////////////////////////
  133. // CTestServer::OnChangeDocApi()
  134. //
  135. void CTestServer::OnChangeDocApi()
  136. {
  137.     ASSERT (m_pDoc != NULL);
  138.  
  139.     TRY
  140.     {
  141.         m_pDoc->NotifyChanged();
  142.     }
  143.     CATCH(CException, e)
  144.     {
  145.         MessageBox("An exception was thrown during this operation.  "
  146.             "Please exit Test Server.", "Test Server", MB_ICONINFORMATION);
  147.         return;
  148.     }
  149.     END_CATCH
  150. }
  151.  
  152.  
  153.  
  154. /////////////////////////////////////////////////////////////////////////////
  155. // CTestServer::OnChangeItemApi()
  156. //
  157. void CTestServer::OnChangeItemApi()
  158. {
  159.     if (!m_pItem)
  160.     {
  161.         MessageBox("Need to Create Item First","Test Server",
  162.             MB_ICONINFORMATION);
  163.         return;
  164.     }
  165.  
  166.     TRY
  167.     {
  168.         m_pItem->NotifyChanged();
  169.     }
  170.     CATCH(CException, e)
  171.     {
  172.         MessageBox("An exception was thrown during this operation.  "
  173.             "Please exit Test Server.", "Test Server", MB_ICONINFORMATION);
  174.         return;
  175.     }
  176.     END_CATCH
  177. }
  178.  
  179.