Author: gert
Date: 2007-07-13 00:13:54 -0400 (Fri, 13 Jul 2007)
New Revision: 81921

Added:
   trunk/gert/interactive/bug82070/
   trunk/gert/interactive/bug82070/MainForm.cs
   trunk/gert/interactive/bug82070/default.build
Log:
Added test for bug #82070.


Added: trunk/gert/interactive/bug82070/MainForm.cs
===================================================================
--- trunk/gert/interactive/bug82070/MainForm.cs 2007-07-13 03:38:59 UTC (rev 
81920)
+++ trunk/gert/interactive/bug82070/MainForm.cs 2007-07-13 04:13:54 UTC (rev 
81921)
@@ -0,0 +1,160 @@
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Design;
+using System.Globalization;
+using System.Windows.Forms;
+using System.Windows.Forms.Design;
+
+public class MainForm : Form
+{
+       public MainForm ()
+       {
+               // 
+               // _propertyGrid
+               // 
+               _propertyGrid = new PropertyGrid ();
+               _propertyGrid.Dock = DockStyle.Fill;
+               _propertyGrid.HelpVisible = false;
+               _propertyGrid.SelectedObject = new Config ();
+               Controls.Add (_propertyGrid);
+               // 
+               // MainForm
+               // 
+               ClientSize = new Size (300, 150);
+               Location = new Point (250, 100);
+               StartPosition = FormStartPosition.Manual;
+               Text = "bug #82070";
+               Load += new EventHandler (MainForm_Load);
+       }
+
+       [STAThread]
+       static void Main ()
+       {
+               Application.Run (new MainForm ());
+       }
+
+       void MainForm_Load (object sender, EventArgs e)
+       {
+               InstructionsForm instructionsForm = new InstructionsForm ();
+               instructionsForm.Show ();
+       }
+
+       private PropertyGrid _propertyGrid;
+}
+
+public class Config
+{
+       AttributeTargets[] _targets;
+       [Editor(typeof(TargetsArrayEditor), typeof(UITypeEditor))]
+       public AttributeTargets[] Targets {
+               get { return _targets; }
+               set { _targets = value; }
+       }
+}
+
+public class TargetsArrayEditor : UITypeEditor
+{
+       private IWindowsFormsEditorService edSvc;
+
+       public override UITypeEditorEditStyle 
GetEditStyle(ITypeDescriptorContext context)
+       {
+               return UITypeEditorEditStyle.DropDown;
+       }
+
+       public override Object EditValue(ITypeDescriptorContext context, 
IServiceProvider provider, Object value)
+       {
+               edSvc = (IWindowsFormsEditorService) provider.GetService(typeof 
(IWindowsFormsEditorService));
+               if (edSvc == null)
+                       return value;
+
+               ListBox lb = new ListBox();
+               lb.SelectedIndexChanged += new EventHandler 
(ListBox_SelectedIndexChanged);
+               lb.Items.Add (AttributeTargets.Assembly.ToString ());
+               lb.Items.Add (AttributeTargets.Class.ToString ());
+               edSvc.DropDownControl (lb);
+               if (lb.SelectedIndex != -1)
+                       return new AttributeTargets [] {  (AttributeTargets) 
Enum.Parse (
+                               typeof (AttributeTargets), lb.Text) };
+               return null;
+       }
+
+       void ListBox_SelectedIndexChanged (object sender, EventArgs e)
+       {
+               if (edSvc != null)
+                       edSvc.CloseDropDown ();
+       }
+}
+
+public class InstructionsForm : Form
+{
+       public InstructionsForm ()
+       {
+               // 
+               // _tabControl
+               // 
+               _tabControl = new TabControl ();
+               _tabControl.Dock = DockStyle.Fill;
+               Controls.Add (_tabControl);
+               // 
+               // _bugDescriptionText1
+               // 
+               _bugDescriptionText1 = new TextBox ();
+               _bugDescriptionText1.Dock = DockStyle.Fill;
+               _bugDescriptionText1.Multiline = true;
+               _bugDescriptionText1.Text = string.Format 
(CultureInfo.InvariantCulture,
+                       "Steps to execute:{0}{0}" +
+                       "1. Click on the value of the Targets property.{0}{0}" +
+                       "2. Click the dropdown arrow.{0}{0}" +
+                       "3. Close the dropped down listbox.{0}{0}" +
+                       "Expected result:{0}{0}" +
+                       "1. The value of the Targets property remains 
empty.{0}{0}" +
+                       "2. The Targets property cannot be expanded.",
+                       Environment.NewLine);
+               // 
+               // _tabPage1
+               // 
+               _tabPage1 = new TabPage ();
+               _tabPage1.Text = "#1";
+               _tabPage1.Controls.Add (_bugDescriptionText1);
+               _tabControl.Controls.Add (_tabPage1);
+               // 
+               // _bugDescriptionText2
+               // 
+               _bugDescriptionText2 = new TextBox ();
+               _bugDescriptionText2.Dock = DockStyle.Fill;
+               _bugDescriptionText2.Multiline = true;
+               _bugDescriptionText2.Text = string.Format 
(CultureInfo.InvariantCulture,
+                       "Steps to execute:{0}{0}" +
+                       "1. Click on the value of the Targets property.{0}{0}" +
+                       "2. Click the dropdown arrow.{0}{0}" +
+                       "3. Select \"Class\" in the listbox.{0}{0}" +
+                       "Expected result:{0}{0}" +
+                       "1. The listbox automatically closes.{0}{0}" +
+                       "2. The value of the Target property is now 
\"AttributeTargets[]" +
+                       " Array\".{0}{0}" +
+                       "3. The Targets property can now be expanded.{0}{0}" +
+                       "4. The value of the item in the Targets array is 
\"Class\".",
+                       Environment.NewLine);
+               // 
+               // _tabPage2
+               // 
+               _tabPage2 = new TabPage ();
+               _tabPage2.Text = "#2";
+               _tabPage2.Controls.Add (_bugDescriptionText2);
+               _tabControl.Controls.Add (_tabPage2);
+               // 
+               // InstructionsForm
+               // 
+               ClientSize = new Size (360, 270);
+               Location = new Point (600, 100);
+               StartPosition = FormStartPosition.Manual;
+               Text = "Instructions - bug #82070";
+       }
+
+       private TextBox _bugDescriptionText1;
+       private TextBox _bugDescriptionText2;
+       private TabControl _tabControl;
+       private TabPage _tabPage1;
+       private TabPage _tabPage2;
+}


Property changes on: trunk/gert/interactive/bug82070/MainForm.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/interactive/bug82070/default.build
===================================================================
--- trunk/gert/interactive/bug82070/default.build       2007-07-13 03:38:59 UTC 
(rev 81920)
+++ trunk/gert/interactive/bug82070/default.build       2007-07-13 04:13:54 UTC 
(rev 81921)
@@ -0,0 +1,62 @@
+<project name="bug82070" default="rebuild">
+       <target name="mono-1.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,ONLY_1_1,MONO" />
+       </target>
+
+       <target name="mono-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0,MONO" />
+       </target>
+
+       <target name="net-1.1">
+               <property name="csc.defines" value="NET_1_0,NET_1_1,ONLY_1_1" />
+       </target>
+
+       <target name="net-2.0">
+               <property name="csc.defines" 
value="NET_1_0,NET_1_1,NET_2_0,ONLY_2_0" />
+       </target>
+
+       <property name="frameworks" value="mono-1.0,mono-2.0,net-1.1,net-2.0" />
+
+       <target name="clean">
+               <delete>
+                       <fileset>
+                               <include name="out" />
+                               <include name="test.exe" />
+                       </fileset>
+               </delete>
+       </target>
+
+       <target name="build">
+               <property name="original.targetframework" 
value="${nant.settings.currentframework}" />
+
+               <foreach property="framework" item="String" in="${frameworks}" 
delim=",">
+                       <if test="${framework::exists(framework)}">
+                               <property name="nant.settings.currentframework" 
value="${framework}" />
+                               <call 
target="${nant.settings.currentframework}" />
+                               <call target="run" />
+                               <call target="clean" />
+                       </if>
+               </foreach>
+
+               <property name="nant.settings.currentframework" 
value="${original.targetframework}" />
+       </target>
+
+       <target name="compile">
+               <csc target="winexe" define="${csc.defines}" output="test.exe" 
warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="MainForm.cs" />
+                       </sources>
+                       <references>
+                               <include name="System.Drawing.dll" />
+                               <include name="System.Windows.Forms.dll" />
+                       </references>
+               </csc>
+       </target>
+
+       <target name="run" depends="compile">
+               <exec program="test.exe" managed="true" output="out" />
+               <fail if="${file::exists('out')}" />
+       </target>
+
+       <target name="rebuild" depends="clean, build" />
+</project>


Property changes on: trunk/gert/interactive/bug82070/default.build
___________________________________________________________________
Name: svn:eol-style
   + native

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to