Back to index

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

#include <nsICmdParams.h>

Collaboration diagram for CnsICmdParams:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CnsICmdParams (nsIWebBrowser *mWebBrowser)
void GetValueTypeTest (const char *, const char *, int)
void GetBooleanValueTest (const char *, const char *, int)
void GetLongValueTest (PRInt32, const char *, int)
void GetDoubleValueTest (double, const char *, int)
void GetStringValueTest (char *, const char *, int)
void GetCStringValueTest (const char *, const char *, int)
void SetBooleanValueTest (PRBool, const char *, int)
void SetLongValueTest (PRInt32, const char *, int)
void SetDoubleValueTest (double, const char *, int)
void SetStringValueTest (char *, const char *, int)
void SetCStringValueTest (char *, const char *, int)
void OnStartTests (UINT nMenuID)
void RunAllTests ()
virtual ~CnsICmdParams ()

Static Public Member Functions

static nsICommandParamsGetCommandParamObject ()

Public Attributes

nsCOMPtr< nsIWebBrowserqaWebBrowser
nsCOMPtr< nsICommandManagercmdMgrObj
nsCOMPtr< nsICommandParamscmdParamObj

Detailed Description

Definition at line 22 of file nsICmdParams.h.


Constructor & Destructor Documentation

Definition at line 27 of file nsICmdParams.cpp.

{
       qaWebBrowser = mWebBrowser;
}

Definition at line 32 of file nsICmdParams.cpp.

{
}

Member Function Documentation

void CnsICmdParams::GetBooleanValueTest ( const char *  aCommand,
const char *  stateType,
int  displayMode 
)

Definition at line 74 of file nsICmdParams.cpp.

{
       PRBool retval;

       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj) {
              FormatAndPrintOutput("The input command name = ", aCommand, displayMode);
              FormatAndPrintOutput("The input state type = ", stateType, displayMode);
              cmdMgrObj = CnsICommandMgr::GetCommandMgrObject(qaWebBrowser, displayMode);
              if (!cmdMgrObj) {
                     QAOutput("We didn't get nsICommandMgr object. Test fails.", displayMode);
                     return;
              }
              else
                     cmdMgrObj->GetCommandState(aCommand, nsnull, cmdParamObj);

              rv = cmdParamObj->GetBooleanValue(stateType, &retval);
              RvTestResult(rv, "GetBooleanValue test", displayMode);
              FormatAndPrintOutput("GetBooleanValue() return boolean = ", retval, displayMode);
       }
       else
           QAOutput("GetBooleanValueTest(): We didn't get nsICommandParams object.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 36 of file nsICmdParams.cpp.

{
    nsCOMPtr<nsICommandParams> cmdParamsObj = do_CreateInstance(NS_COMMAND_PARAMS_CONTRACTID,&rv);
       RvTestResult(rv, "GetCommandParamsObject() test", 1); 
    if (!cmdParamsObj) {
        QAOutput("Didn't get nsICommandParams object.");
              return nsnull;
       }
       nsICommandParams *retVal = cmdParamsObj;
       NS_ADDREF(retVal);
       return retVal;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICmdParams::GetCStringValueTest ( const char *  aCommand,
const char *  stateType,
int  displayMode 
)

Definition at line 150 of file nsICmdParams.cpp.

{
       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj) {
              FormatAndPrintOutput("The input command name = ", aCommand, displayMode);
              FormatAndPrintOutput("The input state type = ", stateType, displayMode);
              cmdMgrObj = CnsICommandMgr::GetCommandMgrObject(qaWebBrowser, displayMode);
              if (!cmdMgrObj) {
                     QAOutput("We didn't get nsICommandMgr object. Test fails.", displayMode);
                     return;
              }
              else
                     cmdMgrObj->GetCommandState(aCommand, nsnull, cmdParamObj);
              char *tCstringValue = nsnull;
              rv = cmdParamObj->GetCStringValue(stateType, &tCstringValue);
              RvTestResult(rv, "GetCStringValue test", displayMode);
              FormatAndPrintOutput("the CString value = ", tCstringValue, displayMode);
              if (tCstringValue)
                     nsCRT::free(tCstringValue);        
       }
       else
           QAOutput("GetCStringValueTest: We didn't get nsICommandParams object.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICmdParams::GetDoubleValueTest ( double  value,
const char *  stateType,
int  displayMode 
)

Definition at line 116 of file nsICmdParams.cpp.

{
       double retval;

       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj) {
              FormatAndPrintOutput("The input Set value = ", value, displayMode);
              FormatAndPrintOutput("The input state type = ", stateType, displayMode);
              cmdParamObj->SetDoubleValue(stateType, value);
              rv = cmdParamObj->GetDoubleValue(stateType, &retval);
              RvTestResult(rv, "GetDoubleValue test", displayMode);
              FormatAndPrintOutput("GetDoubleValue() return double = ", retval, displayMode);
       }
       else
           QAOutput("GetDoubleValueTest: We didn't get nsICommandParams object.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICmdParams::GetLongValueTest ( PRInt32  value,
const char *  stateType,
int  displayMode 
)

Definition at line 98 of file nsICmdParams.cpp.

{
       PRInt32       retval;

       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj)
       {
              FormatAndPrintOutput("The input Set value = ", value, displayMode);
              FormatAndPrintOutput("The input state type = ", stateType, displayMode);
              cmdParamObj->SetLongValue(stateType, value);
              rv = cmdParamObj->GetLongValue(stateType, &retval);
              RvTestResult(rv, "GetLongValue test", displayMode);
              FormatAndPrintOutput("GetLongValue() return long = ", retval, displayMode);
       }
       else
           QAOutput("GetLongValueTest: We didn't get nsICommandParams object.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICmdParams::GetStringValueTest ( char *  stringVal,
const char *  stateType,
int  displayMode 
)

Definition at line 133 of file nsICmdParams.cpp.

{
       nsAutoString retval;
       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj) {
              FormatAndPrintOutput("The input string = ", stringVal, displayMode);
              FormatAndPrintOutput("The input state type = ", stateType, displayMode);

              rv = cmdParamObj->SetStringValue(stateType, NS_ConvertASCIItoUCS2(stringVal));             
              rv = cmdParamObj->GetStringValue(stateType, retval);
              RvTestResult(rv, "GetStringValue test", displayMode);
//            FormatAndPrintOutput("GetStringValue() return string = ", retval, displayMode);
       }
       else
           QAOutput("GetStringValueTest: We didn't get nsICommandParams object.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICmdParams::GetValueTypeTest ( const char *  aCommand,
const char *  stateType,
int  displayMode 
)

Definition at line 49 of file nsICmdParams.cpp.

{
       PRInt16 retval;

       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj) {
              FormatAndPrintOutput("The input command name = ", aCommand, displayMode);
              FormatAndPrintOutput("The input state type = ", stateType, displayMode);
              cmdMgrObj = CnsICommandMgr::GetCommandMgrObject(qaWebBrowser, displayMode);
              if (!cmdMgrObj) {
                     QAOutput("We didn't get nsICommandMgr object. Test fails.", displayMode);
                     return;
              }
              else {
                     rv = cmdMgrObj->GetCommandState(aCommand, nsnull, cmdParamObj);
                     RvTestResult(rv, "cmdMgrObj->GetCommandState test", displayMode);
              }
              rv = cmdParamObj->GetValueType(stateType, &retval);
              RvTestResult(rv, "GetValueType test", displayMode);
              FormatAndPrintOutput("GetValueType return int = ", retval, displayMode);
       }      
       else
           QAOutput("GetValueTypeTest(): We didn't get nsICommandParams object.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 241 of file nsICmdParams.cpp.

{
       switch(nMenuID)
       {
              case ID_INTERFACES_NSICOMMANDPARAMS_RUNALLTESTS :
                     RunAllTests();
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_GETVALUETYPE :
                     GetValueTypeTest( "cmd_bold", "state_all", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_GETBOOLEANVALUE :
                     GetBooleanValueTest("cmd_bold", "state_mixed", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_GETLONGVALUE  :
                     GetLongValueTest(57000000, "state_attribute", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_GETDOUBLEVALUE :
                     GetDoubleValueTest(5.25, "state_attribute", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_GETSTRINGVALUE :
                     GetStringValueTest("MyString!!", "state_attribute", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_GETCSTRINGVALUE:
                     GetCStringValueTest("cmd_fontColor", "state_attribute", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_GETISUPPORTSVALUE :
                     QAOutput("Not implemented yet.", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_SETBOOLEANVALUE :
                     SetBooleanValueTest(PR_TRUE, "state_attribute", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_SETLONGVALUE :
                     SetLongValueTest(25000000, "state_attribute", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_SETDOUBLEVALUE :
                     SetDoubleValueTest(-3.05, "state_attribute", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_SETSTRINGVALUE :
                     SetStringValueTest("HELLO!", "state_attribute", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_SETCSTRINGVALUE:
                     SetCStringValueTest("#FF0000", "state_attribute", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_SETISUPPORTSVALUE :
                     QAOutput("Not implemented yet.", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_REMOVEVALUE :
                     QAOutput("Not implemented yet.", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_HASMOREELEMENTS :
                     QAOutput("Not implemented yet.", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_FIRST :
                     QAOutput("Not implemented yet.", 2);
                     break;
              case ID_INTERFACES_NSICOMMANDPARAMS_GETNEXT :
                     QAOutput("Not implemented yet.", 2);
                     break;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 302 of file nsICmdParams.cpp.

{
       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj)
        QAOutput("We got nsICommandParams object.", 1);
       else
           QAOutput("We didn't get nsICommandParams object.", 1);

       PRInt16 i;

       QAOutput("Run All nsICommandParam Set and Get tests. Check C:/Temp/TestOutput.txt for test results.", 2);
       for (i=0; i < 50; i++)
       {
              FormatAndPrintOutput("loop cnt = ", i, 1);
              SetBooleanValueTest(CommandTable[i].mBooleanValue, CommandTable[i].mCmdParamState, 1);
              SetLongValueTest(CommandTable[i].mLongValue, CommandTable[i].mCmdParamState, 1);
              SetDoubleValueTest(CommandTable[i].mDoubleValue, CommandTable[i].mCmdParamState, 1);
              SetStringValueTest(CommandTable[i].mStringValue, CommandTable[i].mCmdParamState, 1);
              SetCStringValueTest(CommandTable[i].mCStringValue, CommandTable[i].mCmdParamState, 1);

              GetValueTypeTest(CommandTable[i].mCmdName, CommandTable[i].mCmdParamState, 1);
              GetBooleanValueTest(CommandTable[i].mCmdName, CommandTable[i].mCmdParamState, 1);
              GetLongValueTest(CommandTable[i].mLongValue, CommandTable[i].mCmdParamState, 1);
              GetDoubleValueTest(CommandTable[i].mDoubleValue, CommandTable[i].mCmdParamState, 1);
              GetStringValueTest(CommandTable[i].mStringValue, CommandTable[i].mCmdParamState, 1);
              GetCStringValueTest(CommandTable[i].mCmdName, CommandTable[i].mCmdParamState, 1);
       }
       QAOutput("Other tests Not implemented yet.", 2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICmdParams::SetBooleanValueTest ( PRBool  value,
const char *  stateType,
int  displayMode 
)

Definition at line 176 of file nsICmdParams.cpp.

{
       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj) {
              FormatAndPrintOutput("The input state type = ", stateType, displayMode);
              FormatAndPrintOutput("The input value = ", value, displayMode);
              rv = cmdParamObj->SetBooleanValue(stateType, value);
              RvTestResult(rv, "SetBooleanValue() test", displayMode);
       }
       else
           QAOutput("SetBooleanValueTest(): We didn't get nsICommandParams object.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICmdParams::SetCStringValueTest ( char *  value,
const char *  stateType,
int  displayMode 
)

Definition at line 228 of file nsICmdParams.cpp.

{
       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj) {
              FormatAndPrintOutput("The input state type = ", stateType, displayMode);
              FormatAndPrintOutput("The input value = ", value, displayMode);
              rv = cmdParamObj->SetCStringValue(stateType, value);
              RvTestResult(rv, "SetCStringValue() test", displayMode);
       }
       else
           QAOutput("SetCStringValueTest(): We didn't get nsICommandParams object.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICmdParams::SetDoubleValueTest ( double  value,
const char *  stateType,
int  displayMode 
)

Definition at line 202 of file nsICmdParams.cpp.

{
       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj) {
              FormatAndPrintOutput("The input state type = ", stateType, displayMode);
              FormatAndPrintOutput("The input value = ", value, displayMode);
              rv = cmdParamObj->SetDoubleValue(stateType, value);
              RvTestResult(rv, "SetDoubleValue() test", displayMode);
       }
       else
           QAOutput("SetDoubleValueTest(): We didn't get nsICommandParams object.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICmdParams::SetLongValueTest ( PRInt32  value,
const char *  stateType,
int  displayMode 
)

Definition at line 189 of file nsICmdParams.cpp.

{
       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj) {
              FormatAndPrintOutput("The input state type = ", stateType, displayMode);
              FormatAndPrintOutput("The input value = ", value, displayMode);
              rv = cmdParamObj->SetLongValue(stateType, value);
              RvTestResult(rv, "SetLongValue() test", displayMode);
       }
       else
           QAOutput("SetLongValueTest(): We didn't get nsICommandParams object.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CnsICmdParams::SetStringValueTest ( char *  value,
const char *  stateType,
int  displayMode 
)

Definition at line 215 of file nsICmdParams.cpp.

{
       cmdParamObj = GetCommandParamObject();
       if (cmdParamObj) {
              FormatAndPrintOutput("The input state type = ", stateType, displayMode);
              FormatAndPrintOutput("The input value = ", value, displayMode);
              rv = cmdParamObj->SetStringValue(stateType, NS_ConvertASCIItoUCS2(value));
              RvTestResult(rv, "SetStringValue() test", displayMode);
       }
       else
           QAOutput("SetStringValueTest(): We didn't get nsICommandParams object.", 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 29 of file nsICmdParams.h.

Definition at line 30 of file nsICmdParams.h.

Definition at line 28 of file nsICmdParams.h.


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