home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / ADDON.PAK / MPDTEST.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  2.8 KB  |  138 lines

  1. /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2.  
  3.   mpdtest.cpp
  4.   Created: 10/24/95
  5.   Copyright (c) 1995, Borland International
  6.   $Revision:   1.19  $
  7.     
  8. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ 
  9. #ifndef __AOEXPCH_H
  10.   #include "aoexpch.h"
  11. #endif
  12. #pragma hdrstop
  13.  
  14. #include <owl\window.h>
  15. #include <ideaddon\impd.h>
  16. #include "mpdtest.h"
  17. #include "addonpg.h"
  18.  
  19.  
  20. /******************************************************************************
  21. *
  22. * MpdTest
  23. *  MpdText demonstrates Enviroment and Project chapter in IDE
  24. *
  25. ******************************************************************************/
  26.  
  27. MpdTest::MpdTest() {
  28.   d_chapPrj = 0;
  29.   d_chapEnv = 0;
  30. }
  31.  
  32. MpdTest::~MpdTest() {}
  33.  
  34. const char * MpdTest::GetName() { return "MPD test";}
  35.  
  36. BOOL MpdTest::Init() 
  37. {
  38.   d_impdServer = GET_INTERFACE(IMpdServer);
  39.  
  40.   OutStr("Addon_Mpd created, click Test1 to add test chapter");
  41.   return TRUE;
  42. }
  43.  
  44.  
  45. void MpdTest::UnInit() 
  46. {
  47.   if (d_impdServer) {
  48.     d_impdServer->Release();
  49.     d_impdServer = 0;
  50.   }
  51. }
  52.  
  53.  
  54. const char * MpdTest::GetTestDescription( int testNum ) 
  55.   {
  56.   switch ( testNum )
  57.     {
  58.     case 1: 
  59.       return "Add MPD pages to Project";
  60.     case 2:
  61.       return "Remove MPD pages from Project";
  62.     case 3: 
  63.       return "Add MPD pages to Enviroment";
  64.     case 4: 
  65.       return "Remove MPD pages from Environment";
  66.     }
  67.   return "This test not implemented";
  68.   } 
  69.  
  70.  
  71.  
  72. void MpdTest::DoTest1() {
  73.   //
  74.   // add this Project to environment MPD
  75.   //
  76.   IMpdProjectChapterAddon* c = new IMpdProjectChapterAddon;
  77.   d_chapPrj = c;
  78.   c->Init();
  79.   d_chapPrj->AddRef();
  80.   d_impdServer->RegisterChapter(d_chapPrj, MT_ProjectOptions);
  81.  
  82.   OutStr("Test chapter registered, select Option->Project to see new pages");
  83. }
  84.  
  85. void MpdTest::DoTest2() {
  86.   if ( d_chapPrj ) {   
  87.     d_impdServer->UnRegisterChapter(d_chapPrj);  // object will be released
  88.     d_chapPrj = 0;
  89.   }
  90. };
  91.  
  92. void MpdTest::DoTest3() {
  93.   //
  94.   // add this chapter to environment MPD
  95.   //
  96.   IMpdChapterAddon* c = new IMpdChapterAddon;
  97.   d_chapEnv = c;
  98.   c->Init();
  99.  
  100.   d_chapEnv->AddRef();
  101.   d_impdServer->RegisterChapter(d_chapEnv, MT_EnvironmentOptions);
  102.  
  103.   OutStr("Test chapter registered, select Option->Environment to see new pages");
  104. }
  105.  
  106. void MpdTest::DoTest4() {
  107.   if ( d_impdServer ) {
  108.     d_impdServer->UnRegisterChapter(d_chapEnv);  // object will be released
  109.     d_chapEnv = 0;
  110.   }
  111. };
  112.  
  113. void MpdTest::DoTest( int testNum ) 
  114. {
  115.   switch ( testNum ) 
  116.   { 
  117.     case 1: 
  118.       DoTest1();
  119.       break;
  120.     case 2: 
  121.       DoTest2();
  122.       break;
  123.     case 3:
  124.       DoTest3();
  125.       break;
  126.     case 4:
  127.       DoTest4();
  128.       break;
  129.     default: 
  130.     {
  131.       OutStr( FormatStr( "Test #%d Not Implemented!", testNum ) );
  132.       break;
  133.     }
  134.   }
  135. }
  136.  
  137. 
  138.