###############################################################################
#
# winforms3.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

source [file join [file normalize [file dirname [info script]]] prologue.eagle]

###############################################################################
# MONO: On Mono 3.0.2 beta, these tests do not function properly due to
#       a total failure to load the System.Windows.Forms assembly, resulting
#       from incorrect DLL mappings in the "etc/mono/config" configuration
#       file copied by the installer.  Attempts to load and/or use Windows
#       Forms functionality will result in a very complex looking exception,
#       with the innermost exception being very similar to the following:
#
#       System.DllNotFoundException: /tmp/install/lib/libgdiplus.so
#
#       The workaround to "fix" this issue on Windows is to simply remove
#       the both "gdiplus" related lines from the configuration file.
#
#       See: https://bugzilla.xamarin.com/show_bug.cgi?id=8309
###############################################################################

runTest {test winForms-3.1 {create and show a form, import search} -body {
  #
  # NOTE: This is the super-streamlined version of the WinForms
  #       example/text.  The usage of [object load -import] and
  #       [object create -alias] makes this type of .NET
  #       Framework object usage very neat and tidy.
  #
  set assembly [object load -import System.Windows.Forms]

  #
  # NOTE: Requires searching through assemblies loaded into AppDomain.
  #
  list $assembly [set form [object create -alias Form]] [$form Show]
} -cleanup {
  cleanupWinForms

  unset -nocomplain form assembly
} -constraints {eagle compile.WINFORMS winForms} -match regexp -result \
{\{\{System\.Windows\.Forms, Version=\d+\.0\.0\.0, Culture=neutral,\
PublicKeyToken=b77a5c561934e089\}\
[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\
\d+\} System#Windows#Forms#Form#\d+ \{\}}}

###############################################################################

source [file join [file normalize [file dirname [info script]]] epilogue.eagle]
