Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
GeometryTest Class Reference
Collaboration diagram for GeometryTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GeometryTest (BasicTest *aDoc)
virtual ~GeometryTest ()
void CreateGeometry (BasicTest *aDoc, nsPresContext *aPC)
 given a content model, create a geometry model
void VerifyGeometry (BasicTest *aDoc, nsPresContext *aPC)

Public Attributes

nsIPresShellmShell
nsIViewManagermViewManager
nsIFramemRootFrame

Detailed Description

Definition at line 78 of file TableContentTest.cpp.


Constructor & Destructor Documentation

Definition at line 430 of file TableContentTest.cpp.

{
  PRInt32 rows = 4;
  PRInt32 cols = 3;

#if 0
  NS_InitToolkit(PR_GetCurrentThread());

  //NS_NewDeviceContext(&scribbleData.mContext);
  NS_NewWindow(NULL, NS_GET_IID(nsIWidget), nsnull);

#endif

  nsIDeviceContext *dx;
  
  static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);

  nsresult rv = CallCreateInstance(kDeviceContextCID, &dx);

  if (NS_OK == rv) {
    dx->Init(nsnull);
    dx->SetDevUnitsToAppUnits(dx->DevUnitsToTwips());
    dx->SetAppUnitsToDevUnits(dx->TwipsToDevUnits());
  }

  nsPresContext * pc = nsnull;
  nsresult status = NS_NewGalleyContext(&pc);
  if ((NS_FAILED(status)) ||  nsnull==pc)
  {
    fprintf(out, "bad galley pc");
    NS_ASSERTION(PR_FALSE, "bad galley pc");
  }

  pc->Init(dx, nsnull);

  // create a view manager
  nsIViewManager * vm = nsnull;

  static NS_DEFINE_IID(kViewManagerCID, NS_VIEW_MANAGER_CID);

  status = CallCreateInstance(kViewManagerCID, &vm);

  if ((NS_FAILED(status)) ||  nsnull==vm)
  {
    fprintf(out, "bad view manager");
    NS_ASSERTION(PR_FALSE, "bad view manager");
  }
  vm->Init(pc);

  nsRect bounds(0, 0, 10000, 10000);
  nsIScrollableView * rootView = vm->CreateScrollableView(bounds, nsnull);

  if ((NS_FAILED(status)) ||  nsnull==rootView)
  {
    fprintf(out, "bad view");
    NS_ASSERTION(PR_FALSE, "bad view");
  }
  vm->SetRootView(rootView->View());

  nsCOMPtr<nsIStyleSet> ss(do_CreateInstance(kStyleSetCID,&status));
  if ((NS_FAILED(status)))
  {
    fprintf(out, "bad style set");
    NS_ASSERTION(PR_FALSE, "bad style set");
  }

  mShell = nsnull;
  status = NS_NewPresShell(&mShell);
  if ((NS_FAILED(status)) ||  nsnull==mShell)
  {
    fprintf(out, "bad presentation shell.");
    NS_ASSERTION(PR_FALSE, "");
  }
  mShell->Init(aDoc, pc, vm, ss);

  aDoc->CreateCorrectContent(rows, cols);
  CreateGeometry(aDoc, pc);
  VerifyGeometry(aDoc, pc);

  aDoc->CreateCorrectFullContent(rows, cols);
  CreateGeometry(aDoc, pc);
  VerifyGeometry(aDoc, pc);

  /* paginated tests not ready yet...
  NS_RELEASE(pc);
  pc = nsnull;
  status = NS_NewPrintPreviewContext(&pc);
  if ((NS_FAILED(status)) ||  nsnull==pc)
  {
    fprintf(out, "bad paginated pc");
    NS_ASSERTION(PR_FALSE, "");
  }
  pc->Init(dx, nsnull);
  aDoc->CreateCorrectContent(rows, cols);
  CreateGeometry(aDoc, pc);
  VerifyGeometry(aDoc, pc);

  aDoc->CreateCorrectFullContent(rows, cols);
  CreateGeometry(aDoc, pc);
  VerifyGeometry(aDoc, pc);
  */
}

Here is the call graph for this function:

virtual GeometryTest::~GeometryTest ( ) [inline, virtual]

Definition at line 83 of file TableContentTest.cpp.

{};

Member Function Documentation

given a content model, create a geometry model

Definition at line 534 of file TableContentTest.cpp.

{
  nsIContent *root;
  aDoc->GetRootContent(&root);
  nsIContentDelegate* cd = root->GetDelegate(aPC);
  if (nsnull != cd) {
    mRootFrame = cd->CreateFrame(aPC, root, -1, nsnull);
    NS_RELEASE(cd);
    if (nsnull==mRootFrame)
    {
      fprintf(out, "mRootFrame failed\n");
      NS_ASSERTION(PR_FALSE, "mRootFrame failed\n");
    }

    // Bind root frame to root view (and root window)
    mViewManager = mShell->GetViewManager();
    if (nsnull==mViewManager)
    {
      fprintf(out, "bad view manager");
      NS_ASSERTION(PR_FALSE, "");
    }
    nsIView* rootView = mViewManager->GetRootView();
    NS_ASSERTION(nsnull!=rootView, "bad root view");
    mRootFrame->SetView(rootView);
    NS_RELEASE(rootView);
  }
  else {
    fprintf(out, "ERROR: no root delegate\n");
    NS_ASSERTION(PR_FALSE, "no root delegate");
  }
  NS_RELEASE(root);

  nsHTMLReflowMetrics desiredSize;
  nsSize          maxSize(400, 600);
  nsSize          maxElementSize;


  mRootFrame->ResizeReflow(aPC, desiredSize, maxSize, &maxElementSize);

  
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 576 of file TableContentTest.cpp.

{
  mRootFrame->List(out);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 91 of file TableContentTest.cpp.

Definition at line 89 of file TableContentTest.cpp.

Definition at line 90 of file TableContentTest.cpp.


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