Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes
CnsICommandMgr Class Reference

#include <nsICommandMgr.h>

Collaboration diagram for CnsICommandMgr:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CnsICommandMgr (nsIWebBrowser *mWebBrowser)
void IsCommandSupportedTest (const char *, PRInt16)
void IsCommandEnabledTest (const char *, PRInt16)
void GetCommandStateTest (const char *, PRInt16)
void DoCommandTest (const char *, const char *, PRInt16)
void OnStartTests (UINT nMenuID)
void RunAllTests ()
virtual ~CnsICommandMgr ()

Static Public Member Functions

static nsICommandManagerGetCommandMgrObject (nsIWebBrowser *aWebBrowser, PRInt16)
static nsICommandManagerGetCommandMgrWithContractIDObject (PRInt16)

Public Attributes

nsCOMPtr< nsIWebBrowserqaWebBrowser
nsCOMPtr< nsICommandManagercmdMgrObj
nsCOMPtr< nsICommandParamscmdParamObj

Detailed Description

Definition at line 60 of file nsICommandMgr.h.


Constructor & Destructor Documentation

Definition at line 64 of file nsICommandMgr.cpp.

{
       qaWebBrowser = mWebBrowser;
}

Definition at line 69 of file nsICommandMgr.cpp.

{
}

Member Function Documentation

void CnsICommandMgr::DoCommandTest ( const char *  aCommandName,
const char *  doCommandState,
PRInt16  displayMethod 
)

Definition at line 203 of file nsICommandMgr.cpp.

{
       nsCAutoString value;

       FormatAndPrintOutput("the Command input = ", aCommandName, displayMethod);
       cmdMgrObj = GetCommandMgrObject(qaWebBrowser, displayMethod);
       cmdParamObj = CnsICmdParams::GetCommandParamObject();
       if (!cmdMgrObj) {
        QAOutput("Didn't get nsICommandManager object. Tests fail");
              return;
       }

       if (strcmp(doCommandState, "state_attribute") == 0)
       {
              if (strcmp(aCommandName,"cmd_fontColor") == 0 ||
                  strcmp(aCommandName,"cmd_backgroundColor") == 0)
                     value = "#FF0000";
              else if (strcmp(aCommandName,"cmd_fontFace") == 0)
                     value = "Helvetica, Ariel, san-serif";
              else
                     value = "left";

              if (cmdParamObj)
                     cmdParamObj->SetCStringValue("state_attribute", value.get());
              else
                     QAOutput("Didn't get nsICommandParam object for nsICommandMgr test.");
       }
       rv = cmdMgrObj->DoCommand(aCommandName, cmdParamObj, nsnull);
       RvTestResult(rv, "DoCommand() test", displayMethod);
       if (displayMethod == 1)
              RvTestResultDlg(rv, "DoCommand() test");
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsICommandManager * CnsICommandMgr::GetCommandMgrObject ( nsIWebBrowser aWebBrowser,
PRInt16  displayMethod 
) [static]

Definition at line 127 of file nsICommandMgr.cpp.

{
       nsCOMPtr<nsIWebBrowser> wb(aWebBrowser);
       nsCOMPtr<nsICommandManager> cmdMgrObj = do_GetInterface(wb, &rv);
       RvTestResult(rv, "GetCommandMgrObject() test", displayMethod);
    if (!cmdMgrObj) {
        QAOutput("Didn't get nsICommandManager object.");
              return nsnull;
       }
       return cmdMgrObj;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 139 of file nsICommandMgr.cpp.

{
       nsCOMPtr<nsICommandManager> cmdMgrObj = do_CreateInstance(NS_COMMAND_MANAGER_CONTRACTID, &rv);
       RvTestResult(rv, "GetCommandMgrWithContractIDObject() test", 1); 
    if (!cmdMgrObj) {
        QAOutput("Didn't get nsICommandManager object.");
              return nsnull;
       }
       return cmdMgrObj;
}

Here is the call graph for this function:

void CnsICommandMgr::GetCommandStateTest ( const char *  aCommandName,
PRInt16  displayMethod 
)

Definition at line 184 of file nsICommandMgr.cpp.

{
       PRBool enabled = PR_FALSE;

       FormatAndPrintOutput("the Command input = ", aCommandName, displayMethod);
       cmdMgrObj = GetCommandMgrObject(qaWebBrowser, displayMethod);
       cmdParamObj = CnsICmdParams::GetCommandParamObject();
       if (!cmdMgrObj) {
        QAOutput("Didn't get nsICommandManager object.");
              return;
       }
       rv = cmdMgrObj->GetCommandState(aCommandName, nsnull, cmdParamObj);
       RvTestResult(rv, "GetCommandState() test", displayMethod);
       if (displayMethod == 1)
              RvTestResultDlg(rv, "GetCommandState() test");
       if (!cmdParamObj) 
        QAOutput("Didn't get nsICommandParams object for GetCommandStateTest.");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICommandMgr::IsCommandEnabledTest ( const char *  aCommandName,
PRInt16  displayMethod 
)

Definition at line 167 of file nsICommandMgr.cpp.

{
       PRBool isEnabled;

       FormatAndPrintOutput("the Command input = ", aCommandName, displayMethod);
       cmdMgrObj = GetCommandMgrObject(qaWebBrowser, displayMethod);
       if (!cmdMgrObj) {
        QAOutput("Didn't get nsICommandManager object.");
              return;
       }
       rv = cmdMgrObj->IsCommandEnabled(aCommandName, nsnull, &isEnabled);
       RvTestResult(rv, "IsCommandEnabled() test", displayMethod);
       if (displayMethod == 1)
              RvTestResultDlg(rv, "IsCommandEnabled() test");
       FormatAndPrintOutput("isEnabled boolean = ", isEnabled, displayMethod);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICommandMgr::IsCommandSupportedTest ( const char *  aCommandName,
PRInt16  displayMethod 
)

Definition at line 150 of file nsICommandMgr.cpp.

{
       PRBool isSupported;

       FormatAndPrintOutput("the Command input = ", aCommandName, displayMethod);
       cmdMgrObj = GetCommandMgrObject(qaWebBrowser, displayMethod);
       if (!cmdMgrObj) {
        QAOutput("Didn't get nsICommandManager object. Test failed.");
              return;
       }
       rv = cmdMgrObj->IsCommandSupported(aCommandName, nsnull, &isSupported);
       RvTestResult(rv, "IsCommandSupported() test", displayMethod);
       if (displayMethod == 1)
              RvTestResultDlg(rv, "IsCommandSupported() test", true);
       FormatAndPrintOutput("isSupported boolean = ", isSupported, displayMethod);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 239 of file nsICommandMgr.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 267 of file nsICommandMgr.cpp.

{
       PRInt16 i;

       QAOutput("Run All nsICommandManager tests. Check C:/Temp/TestOutput.txt for test results.", 2);
       for (i=0; i < 50; i++)
       {
              FormatAndPrintOutput("loop cnt = ", i, 1);
              IsCommandSupportedTest(CommandTable[i].mCmdName, 1);
              IsCommandEnabledTest(CommandTable[i].mCmdName, 1);
              GetCommandStateTest(CommandTable[i].mCmdName, 1);
              DoCommandTest(CommandTable[i].mCmdName,
                                     CommandTable[i].mDoCmdState, 1);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 67 of file nsICommandMgr.h.

Definition at line 68 of file nsICommandMgr.h.

Definition at line 66 of file nsICommandMgr.h.


The documentation for this class was generated from the following files: