How to test using conditional defines if the application is Firemonkey one?

Posted by Gad D Lord on Stack Overflow See other posts from Stack Overflow or by Gad D Lord
Published on 2012-09-21T09:10:11Z Indexed on 2012/09/21 9:37 UTC
Read the original article Hit count: 224

I use DUnit. It has an VCL GUITestRunner and a console TextTestRunner.

In an unit used by both Firemonkey and VCL Forms applications I would like to achieve the following:

  1. If Firemonkey app, if target is OS X, and executing on OS X -> TextTestRunner
  2. If Firemonkey app, if target is 32-bit Windows, executing on Windows -> AllocConsole + TextTestRunner
  3. If VCL app -> GUITestRunner

{$IFDEF MACOS}
TextTestRunner.RunRegisteredTests;      // Case 1
{$ELSE}
   {$IFDEF MSWINDOWS}
   AllocConsole;
   {$ENDIF}
   {$IFDEF FIREMONKEY_APP}              // Case 2 <--------------- HERE
   TextTestRunner.RunRegisteredTests;  
   {$ELSE}                              // Case 3
   GUITestRunner.RunRegisteredTests;
   {$IFEND}
{$ENDIF}

Which is the best way to make Case 2 work?

© Stack Overflow or respective owner

Related posts about delphi

Related posts about cross-platform