Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends

QmitkFunctionalityTest Class Reference

#include <QmitkFunctionalityTest.h>

Inheritance diagram for QmitkFunctionalityTest:
Inheritance graph
[legend]
Collaboration diagram for QmitkFunctionalityTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 QmitkFunctionalityTest (const std::string &testName)
void TestOpenAndClose ()
void TestOpenAndWindowClose ()

Static Public Member Functions

static CppUnit::Test * Suite ()

Protected Member Functions

void DoSetUp ()
void DoTearDown ()

Protected Attributes

berry::IWorkbenchWindow::Pointer fWindow
berry::IWorkbenchPage::Pointer fPage

Friends

class CppUnit::TestCaller< QmitkFunctionalityTest >

Detailed Description

Test cases for the QmitkFunctionality API.

Definition at line 32 of file QmitkFunctionalityTest.h.


Constructor & Destructor Documentation

QmitkFunctionalityTest::QmitkFunctionalityTest ( const std::string &  testName )

Definition at line 25 of file QmitkFunctionalityTest.cpp.

 : berry::UITestCase(testName)
{

}

Member Function Documentation

void QmitkFunctionalityTest::DoSetUp (  ) [protected, virtual]

Reimplemented from berry::UITestCase.

Definition at line 40 of file QmitkFunctionalityTest.cpp.

References fPage, fWindow, and berry::UITestCase::OpenTestWindow().

{
  UITestCase::DoSetUp();
  fWindow = OpenTestWindow();
  fPage = fWindow->GetActivePage();
}
void QmitkFunctionalityTest::DoTearDown (  ) [protected, virtual]

Reimplemented from berry::UITestCase.

Definition at line 47 of file QmitkFunctionalityTest.cpp.

References fPage, and fWindow.

CppUnit::Test * QmitkFunctionalityTest::Suite (  ) [static]

Definition at line 31 of file QmitkFunctionalityTest.cpp.

References TestOpenAndClose().

Referenced by QmitkUiApiTestSuite::QmitkUiApiTestSuite().

{
  CppUnit::TestSuite* suite = new CppUnit::TestSuite("QmitkFunctionalityTest");

  CppUnit_addTest(suite, QmitkFunctionalityTest, TestOpenAndClose);

  return suite;
}
void QmitkFunctionalityTest::TestOpenAndClose (  )

Definition at line 54 of file QmitkFunctionalityTest.cpp.

References berry::SmartPointer< TObjectType >::Cast(), fPage, ID, and berry::TestCase::IgnoreLeakingObjects().

Referenced by Suite().

{
  this->IgnoreLeakingObjects();

  berry::CallHistory::Pointer history;
  std::vector<std::string> callOrder;
  {
    // Open a functionality.
    QmitkMockFunctionality::Pointer part = fPage->ShowView(QmitkMockFunctionality::ID).Cast<QmitkMockFunctionality> ();
    history = part->GetCallHistory();

    //callOrder.push_back("SetInitializationData");
    //callOrder.push_back("Init");
    callOrder.push_back("CreateQtPartControl");
    callOrder.push_back("SetFocus");

    assert(history->VerifyOrder(callOrder));

    // Close the part.
    fPage->HideView(part.Cast<berry::IViewPart>());
  }

  //callOrder.push_back("WidgetDisposed");
  callOrder.push_back("FunctionalityDestructor");
  assert(history->VerifyOrder(callOrder));
}
void QmitkFunctionalityTest::TestOpenAndWindowClose (  )

Definition at line 81 of file QmitkFunctionalityTest.cpp.

References berry::SmartPointer< TObjectType >::Cast(), ID, berry::TestCase::IgnoreLeakingObjects(), and berry::UITestCase::OpenTestWindow().

{
  this->IgnoreLeakingObjects();

  berry::CallHistory::Pointer history;
  std::vector<std::string> callOrder;
  {
    // Open a new window
    berry::IWorkbenchWindow::Pointer newWindow = OpenTestWindow();

    // Open a part.
    QmitkMockFunctionality::Pointer part = newWindow->GetActivePage()->ShowView(QmitkMockFunctionality::ID).Cast<QmitkMockFunctionality> ();;
    history = part->GetCallHistory();

    //callOrder.push_back("SetInitializationData");
    //callOrder.push_back("Init");
    callOrder.push_back("CreateQtPartControl");
    callOrder.push_back("SetFocus");

    assert(history->VerifyOrder(callOrder));

    // Close the window.
    newWindow->Close();
  }

  //callOrder.push_back("WidgetDisposed");
  callOrder.push_back("FunctionalityDestructor");
  assert(history->VerifyOrder(callOrder));
}

Friends And Related Function Documentation

friend class CppUnit::TestCaller< QmitkFunctionalityTest > [friend]

Definition at line 36 of file QmitkFunctionalityTest.h.


Member Data Documentation

Definition at line 48 of file QmitkFunctionalityTest.h.

Referenced by DoSetUp(), DoTearDown(), and TestOpenAndClose().

Definition at line 47 of file QmitkFunctionalityTest.h.

Referenced by DoSetUp(), and DoTearDown().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines