Back to index

nux  3.0.0
Classes | Functions | Variables
xtest-button.cpp File Reference
#include "Nux/Nux.h"
#include "Nux/WindowThread.h"
#include "Nux/VLayout.h"
#include "Nux/Button.h"
#include "Nux/ProgramFramework/ProgramTemplate.h"
#include <X11/extensions/XTest.h>
#include <X11/keysym.h>
#include "nux_automated_test_framework.h"

Go to the source code of this file.

Classes

class  TestButton

Functions

void TestingThread (nux::NThread *thread, void *user_data)
int main (int argc, char **argv)

Variables

TestButtontest_button = NULL

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 125 of file xtest-button.cpp.

{
  int xstatus = XInitThreads();
  nuxAssertMsg(xstatus > 0, "XInitThreads has failed");

  test_button = new TestButton("Button XTest", 300, 300, 10000);
  test_button->Startup();
  test_button->UserInterfaceSetup();

  nux::SystemThread* test_thread = nux::CreateSystemThread(NULL, &TestingThread, test_button->GetWindowThread());

  test_thread->Start(test_button);

  test_button->Run();

  delete test_thread;
  delete test_button;

  //nuxDebugMsg("Exit program");
  return 0;
}

Here is the call graph for this function:

void TestingThread ( nux::NThread thread,
void *  user_data 
)

Definition at line 93 of file xtest-button.cpp.

{
  while (test_button->ReadyToGo() == false)
  {
    nuxDebugMsg("Waiting to start");
    nux::SleepForMilliseconds(300);
  }

  nux::SleepForMilliseconds(1300);

  nux::WindowThread* wnd_thread = static_cast<nux::WindowThread*>(user_data);

  NuxAutomatedTestFramework test(wnd_thread);

  test.Startup();

  test.TestReportMsg(test_button->button_, "Button created");

  test_button->ResetEvents();
  test.ViewSendMouseMotionToCenter(test_button->button_);
  test.ViewSendMouseClick(0, 1);

  nux::SleepForMilliseconds(1000);
  test.TestReportMsg(test_button->clicked_, "Button clicked");

  if (test.WhenDoneTerminateProgram())
  {
    wnd_thread->ExitMainLoop();
  }
  nuxDebugMsg("Exit testing thread");
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 91 of file xtest-button.cpp.