title: Using a QT window as part of a C++ unit test
body: <p>I have some code which uses WinAPI to get the title and classname of a window from it's handle using <code>GetWindowTextW</code> and <code>GetClassNameW</code>. I would like to create a unit test for this code using Qt to create a temporary window, run my code against it, and then close the window. However I'm unsure how to go about doing this in a simple way. For example, I could create the window as follows:</p>
  
  <pre><code>#include "QtWidgets\qapplication.h"
  #include "QtWidgets\qtextedit.h"
  int argc = 1;
  char* argv[1];
  QApplication app(argc, &amp;argv[0]);
  QTextEdit textEdit;
  textEdit.show();
  app.exec(;)
  // Rest of my unit test here
  </code></pre>
  
  <p>However at that point the QApplication object enters it's event loop and assumes control of my unit test until I close the window. What is the best way to allow my unit test to continue operating on the window? Should I create a separate thread for the window? Being a unit test, I would like to keep it as simple as possible.</p>
  
  <p>This question is intended to be unit test framework independent, but in case it matters, I'm using UnitTest++.</p>