Back to index

lightning-sunbird  0.9+nobinonly
Functions
main.cpp File Reference
#include "nsIWidget.h"

Go to the source code of this file.

Functions

nsresult CoverageTest (int *argc, char **argv)
 


Function Documentation

nsresult CoverageTest ( int argc,
char **  argv 
)


Definition at line 325 of file nsCoverage.cpp.

{
    nsresult res = NS_InitXPCOM2(nsnull, nsnull, nsnull);
    if (NS_FAILED(res))
        return res;

    // Create the Event Queue for the UI thread...
    nsCOMPtr<nsIEventQueueService> eventQService =
        do_GetService(kEventQueueServiceCID, &res);

    if (NS_OK != res) {
        NS_ASSERTION(PR_FALSE, "Could not obtain the event queue service");
        return res;
    }

      // Create a application shell
    nsIAppShell *appShell;
    CallCreateInstance(kCAppShellCID, &appShell);
    if (appShell != nsnull) {
      fputs("Created AppShell\n", stderr);
      appShell->Create(argc, argv);
    } else {
      printf("AppShell is null!\n");
    }

    nsIDeviceContext* deviceContext = 0;

    // Create a device context for the widgets

    static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
    static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);

    //
    // create the main window
    //
    CallCreateInstance(kCWindowCID, &gWindow);
    nsRect rect(100, 100, 600, 700);
    gWindow->Create((nsIWidget*) nsnull, rect, HandleEvent, 
                   (nsIDeviceContext *) nsnull,
                   appShell);

    nsAutoString strTitle(NS_LITERAL_STRING("Pixel coverage test"));
    gWindow->SetTitle(strTitle);


    //
    // Create Device Context based on main window
    //
    res = CallCreateInstance(kDeviceContextCID, &deviceContext);

    if (NS_OK == res)
    {
      deviceContext->Init(gWindow->GetNativeData(NS_NATIVE_WIDGET));
      NS_ADDREF(deviceContext);
    }

    gWindow->Show(PR_TRUE);

 
    return(appShell->Run());
}

Here is the call graph for this function: