home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / qadelmsg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.7 KB  |  122 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. //
  19. // Filename: qadelmsg.cpp
  20. // Original author: ppandit
  21. // Purpose: To accept handoff from whitebox UI via call to WhiteBox_DeleteMessage1().
  22. //          Proceed with deleting the sixth message in the Inbox. During the deletion,
  23. //          trace statements will record parameter and debug information in
  24. //          a file (ex. Test1.log). When the deletion is completed, a verification
  25. //          procedure will confirm if that message is actually gone. Notifications
  26. //          play a big part. We check for MSG_PaneNotifyMessageLoaded and
  27. //          MSG_PaneNotifyMessageDeleted in thrdfrm.cpp. Code looks scattered
  28. //          because we have to deal with the asychronous nature of Communicator.
  29.  
  30. #include "stdafx.h"
  31. #include "stdlib.h"
  32. #include "msgcom.h"
  33. #include "wfemsg.h"
  34. #include "thrdfrm.h"
  35. #include "testcase.h"
  36. #include "resource.h"
  37. #include "qaoutput.h"
  38. #include "qa.h"
  39. #include "qatrace.h"
  40.  
  41.  
  42. #ifdef _DEBUG
  43. #define new DEBUG_NEW
  44. #undef THIS_FILE
  45. static char THIS_FILE[] = __FILE__;
  46. #endif
  47.  
  48. // globals for this test case
  49. C3PaneMailFrame *qainbox;
  50. MessageKey qaSaveMessageKey = MSG_MESSAGEKEYNONE;
  51. MSG_Pane* qapane;
  52. CTestCaseManager *qatcmanager;
  53.  
  54. void WhiteBox_DeleteMessage1(CTestCaseManager *tc)
  55.    // QA_TestCase.PhaseTwoIsFalse();
  56.    bDoWhiteBox = TRUE;
  57.    bWaitForInbox = TRUE;
  58.    QATestCaseStarted = FALSE;
  59.    QATestCaseDone = FALSE;
  60.    qatcmanager = tc;
  61.    qainbox = (C3PaneMailFrame*)WFE_MSGOpenInbox(TRUE);  // make it so getNewMail = TRUE
  62. }
  63.  
  64. void QADoDeleteMessageEventHandler()
  65. {
  66.     if (bWaitForInbox == FALSE && bDoWhiteBox == TRUE)
  67.     {
  68.         // set flag to nolonger enter here
  69.         QATestCaseStarted = TRUE;
  70.         // do real work
  71.         CMsgListFrame* qaMsgListFrame = qainbox;
  72.         qaMsgListFrame->SelectItem(qainbox->GetPane(),5);
  73.         qainbox->WhiteBox_OnSelect();
  74.  
  75.         qapane = qainbox->GetPane();
  76.  
  77.         MessageKey qaSaveMessageKey = MSG_MESSAGEKEYNONE;
  78.         // should chose a better method than GetCurMessage() to get MessageKey.
  79.         qaSaveMessageKey = qainbox->GetCurMessage();
  80.  
  81.         // use the following instead of
  82.         // qainbox->SendMessage(WM_COMMAND, ID_EDIT_DELETEMESSAGE, 0);
  83.         qainbox->WhiteBox_OnDeleteMessage();
  84.  
  85.         // unneeded code but kept here for future use
  86.         // MSG_Master *pMaster = WFE_MSGGetMaster();
  87.         // MSG_Pane* qapane = qainbox->GetPane();
  88.         // qainbox->SendMessage(WM_COMMAND, ID_EDIT_DELETEMESSAGE, 0);
  89.  
  90.     }
  91. }
  92.  
  93. void QADoDeleteMessageEventHandler2()
  94. {
  95.     static count = 0;
  96.  
  97.     if (count > 0) return;
  98.  
  99.     MSG_ViewIndex qaTestMessageExists = MSG_VIEWINDEXNONE;
  100.  
  101.     qaTestMessageExists = MSG_GetMessageIndexForKey(qapane, qaSaveMessageKey, TRUE);
  102.     if (qaTestMessageExists == MSG_VIEWINDEXNONE) {
  103.         QA_TestCase.PhaseTwoIsTrue();
  104.     } else {
  105.         QA_TestCase.PhaseTwoIsFalse();
  106.     }
  107.  
  108.     count += 1;
  109.  
  110.     // done with testcase
  111.     // QA_TestCase.DoWrapup();
  112.     QATestCaseDone = TRUE;
  113. }
  114.  
  115. void TrialTestCase2(CTestCaseManager *qatc)
  116.    AfxMessageBox("This test has not been developed");
  117. }
  118.  
  119.  
  120.