1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
23 // Jordi Mas i Hernandez <jordi@ximian.com>
28 using System.Windows.Forms;
31 using System.Reflection;
32 using System.Runtime.Serialization;
33 using System.Runtime.Serialization.Formatters;
34 using System.Runtime.Serialization.Formatters.Binary;
35 using NUnit.Framework;
37 namespace MonoTests.System.Windows.Forms
40 public class ListViewItemTest : TestHelper
43 public void ListViewItemConstructors ()
45 Font fnt = new Font ("Arial", 12);
46 ListViewItem item1 = new ListViewItem ("Hello folks");
47 Assert.AreEqual ("Hello folks", item1.Text, "Constructor#1");
49 ListViewItem item2 = new ListViewItem (new string [] {"Element1", "Element2"},
50 -1, Color.Blue, Color.Red, fnt);
52 Assert.AreEqual (item2.ForeColor, Color.Blue, "Constructor#2");
53 Assert.AreEqual (item2.BackColor, Color.Red, "Constructor#3");
55 Assert.AreEqual (2, item2.SubItems.Count,"Constructor#4");
56 Assert.AreEqual (Color.Blue, item2.SubItems[0].ForeColor,"Constructor#5");
57 Assert.AreEqual (Color.Red, item2.SubItems[0].BackColor, "Constructor#6");
58 Assert.AreEqual (fnt, item2.SubItems[0].Font, "Constructor#7");
59 Assert.AreEqual ("Element1", item2.SubItems[0].Text, "Constructor#8");
60 Assert.AreEqual ("Element2", item2.SubItems[1].Text, "Constructor#12");
62 ListViewItem item3 = new ListViewItem ((string)null);
63 Assert.AreEqual (String.Empty, item3.Text, "Constructor#13");
65 ListViewItem item4 = new ListViewItem ((string)null, -99);
66 Assert.AreEqual (String.Empty, item4.Text, "Constructor#14");
67 Assert.AreEqual (-99, item4.ImageIndex, "Constructor#15");
69 ListViewItem item5 = new ListViewItem (new string [2]);
70 Assert.AreEqual (2, item5.SubItems.Count, "Constructor#16");
71 Assert.IsNotNull (item5.SubItems [0], "Constructor#17");
72 Assert.IsNotNull (item5.SubItems [1], "Constructor#18");
74 ListViewItem item6 = new ListViewItem (new string [2], -1, Color.Blue, Color.Red,
76 Assert.AreEqual (2, item6.SubItems.Count, "Constructor#19");
77 Assert.IsNotNull (item6.SubItems [0], "Constructor#20");
78 Assert.IsNotNull (item6.SubItems [1], "Constructor#21");
79 Assert.AreEqual (Color.Blue, item6.ForeColor, "Constructor#22");
80 Assert.AreEqual (Color.Blue, item6.SubItems [0].ForeColor, "Constructor#23");
81 Assert.AreEqual (Color.Red, item6.BackColor, "Constructor#24");
82 Assert.AreEqual (Color.Red, item6.SubItems [0].BackColor, "Constructor#25");
83 Assert.AreEqual (fnt, item6.Font, "Constructor#26");
84 Assert.AreEqual (fnt, item6.SubItems [0].Font, "Constructor#27");
88 public void Constructor2_Text_Null ()
90 ListViewItem item = new ListViewItem ((string) null);
91 Assert.AreEqual (-1, item.ImageIndex, "#1");
92 Assert.AreEqual (1, item.SubItems.Count, "#2");
93 Assert.IsNotNull (item.SubItems [0].Text, "#3");
94 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#4");
98 public void Constructor3_Items_Empty ()
100 ListViewItem item = new ListViewItem (new string [3]);
101 Assert.AreEqual (-1, item.ImageIndex, "#1");
102 Assert.AreEqual (3, item.SubItems.Count, "#2");
103 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#3");
104 Assert.AreEqual (string.Empty, item.SubItems [1].Text, "#4");
105 Assert.AreEqual (string.Empty, item.SubItems [2].Text, "#5");
109 public void Constructor3_Items_Null ()
111 ListViewItem item = new ListViewItem ((string []) null);
112 Assert.AreEqual (-1, item.ImageIndex, "#1");
113 Assert.AreEqual (1, item.SubItems.Count, "#2");
114 Assert.IsNotNull (item.SubItems [0].Text, "#3");
115 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#4");
119 [ExpectedException (typeof (NullReferenceException))]
120 public void Constructor4_SubItems_Empty ()
122 new ListViewItem (new ListViewItem.ListViewSubItem [2], 3);
126 [ExpectedException (typeof (NullReferenceException))]
127 public void Constructor4_SubItems_Null ()
129 new ListViewItem ((ListViewItem.ListViewSubItem []) null, 3);
133 public void Constructor5_Text_Null ()
135 ListViewItem item = new ListViewItem ((string) null, 2);
136 Assert.AreEqual (2, item.ImageIndex, "#1");
137 Assert.AreEqual (1, item.SubItems.Count, "#2");
138 Assert.IsNotNull (item.SubItems [0].Text, "#3");
139 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#4");
143 public void Constructor6_Items_Empty ()
145 ListViewItem item = new ListViewItem (new string [3], 5);
146 Assert.AreEqual (5, item.ImageIndex, "#1");
147 Assert.AreEqual (3, item.SubItems.Count, "#2");
148 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#3");
149 Assert.AreEqual (string.Empty, item.SubItems [1].Text, "#4");
150 Assert.AreEqual (string.Empty, item.SubItems [2].Text, "#5");
154 public void Constructor6_Items_Null ()
156 ListViewItem item = new ListViewItem ((string []) null, 3);
157 Assert.AreEqual (3, item.ImageIndex, "#1");
158 Assert.AreEqual (1, item.SubItems.Count, "#2");
159 Assert.IsNotNull (item.SubItems [0].Text, "#3");
160 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#4");
164 public void Constructor7_Items_Empty ()
166 Font font = new Font (FontFamily.GenericSansSerif, 6);
168 ListViewItem item = new ListViewItem (new string [2], 3, Color.Red,
170 Assert.AreEqual (Color.Blue, item.BackColor, "#1");
171 Assert.AreEqual (Color.Red, item.ForeColor, "#2");
172 Assert.AreSame (font, item.Font, "#3");
173 Assert.AreEqual (3, item.ImageIndex, "#4");
174 Assert.AreEqual (2, item.SubItems.Count, "#5");
175 Assert.IsNotNull (item.SubItems [0].Text, "#6");
176 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#7");
177 Assert.IsNotNull (item.SubItems [1].Text, "#8");
178 Assert.AreEqual (string.Empty, item.SubItems [1].Text, "#9");
182 public void Constructor7_Items_Null ()
184 Font font = new Font (FontFamily.GenericSansSerif, 6);
186 ListViewItem item = new ListViewItem ((string []) null, 3, Color.Red,
188 Assert.AreEqual (Color.Blue, item.BackColor, "#1");
189 Assert.AreEqual (Color.Red, item.ForeColor, "#2");
190 Assert.AreSame (font, item.Font, "#3");
191 Assert.AreEqual (3, item.ImageIndex, "#4");
192 Assert.AreEqual (1, item.SubItems.Count, "#5");
193 Assert.IsNotNull (item.SubItems [0].Text, "#6");
194 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#7");
199 public void Constructor9_Text_Null ()
201 ListViewItem item = new ListViewItem ((string) null, "key");
202 Assert.AreEqual (-1, item.ImageIndex, "#1");
203 Assert.IsNotNull (item.ImageKey, "#2");
204 Assert.AreEqual ("key", item.ImageKey, "#3");
205 Assert.AreEqual (1, item.SubItems.Count, "#4");
206 Assert.IsNotNull (item.SubItems [0].Text, "#5");
207 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#6");
211 public void Constructor9_ImageKey_Null ()
213 ListViewItem item = new ListViewItem ("name", (string) null);
214 Assert.AreEqual (-1, item.ImageIndex, "#1");
215 Assert.IsNotNull (item.ImageKey, "#2");
216 Assert.AreEqual (string.Empty, item.ImageKey, "#3");
217 Assert.AreEqual (1, item.SubItems.Count, "#4");
218 Assert.IsNotNull (item.SubItems [0].Text, "#5");
219 Assert.AreEqual ("name", item.SubItems [0].Text, "#6");
223 [ExpectedException (typeof (NullReferenceException))]
224 public void Constructor10_SubItems_Null ()
226 new ListViewItem ((ListViewItem.ListViewSubItem []) null, "key");
230 [ExpectedException (typeof (NullReferenceException))]
231 public void Constructor10_SubItems_Empty ()
233 new ListViewItem (new ListViewItem.ListViewSubItem [2], "key");
237 public void Constructor10_ImageKey_Null ()
239 ListViewItem.ListViewSubItem subItemA = new ListViewItem.ListViewSubItem ();
241 ListViewItem.ListViewSubItem subItemB = new ListViewItem.ListViewSubItem ();
244 ListViewItem item = new ListViewItem (new ListViewItem.ListViewSubItem [] {
245 subItemA, subItemB }, (string) null);
246 Assert.AreEqual (-1, item.ImageIndex, "#1");
247 Assert.IsNotNull (item.ImageKey, "#2");
248 Assert.AreEqual (string.Empty, item.ImageKey, "#3");
249 Assert.AreEqual (2, item.SubItems.Count, "#4");
250 Assert.IsNotNull (item.SubItems [0].Text, "#5");
251 Assert.AreEqual ("A", item.SubItems [0].Text, "#6");
252 Assert.IsNotNull (item.SubItems [1].Text, "#7");
253 Assert.AreEqual ("B", item.SubItems [1].Text, "#8");
257 public void Constructor_Groups ()
259 ListViewItem itemA = new ListViewItem ((ListViewGroup) null);
260 Assert.AreEqual (null, itemA.Group, "#A1");
262 ListViewGroup group = new ListViewGroup ("Group A");
263 group.Items.Add (itemA);
265 ListViewItem itemB = new ListViewItem ("B", group);
266 Assert.AreEqual (group, itemB.Group, "#B1");
267 Assert.AreEqual (2, group.Items.Count, "#B2");
268 Assert.AreEqual (itemB, group.Items [1], "#B3");
272 public void Constructor_Serializable ()
274 ListViewItem item = new ListViewItem ("A");
275 ListView lvw = new ListView ();
276 lvw.Items.Add (item);
277 lvw.CreateControl (); // Need to calculate layout
279 item.SubItems.Add ("B");
280 item.SubItems.Add ("C");
281 item.SubItems.Add ("D");
282 item.BackColor = Color.AliceBlue;
284 item.Font = new Font (item.Font, FontStyle.Bold);
285 item.ForeColor = Color.AntiqueWhite;
287 item.Selected = true;
289 item.UseItemStyleForSubItems = false;
291 ListViewGroup group = lvw.Groups.Add ("GroupKey", "MyGroup");
292 group.Items.Add (item);
294 item.ImageKey = "MyKey";
295 item.IndentCount = 2;
296 item.Name = "MyName";
297 item.ToolTipText = "MyTooltipText";
299 MemoryStream ms = new MemoryStream ();
300 BinaryFormatter formatter = new BinaryFormatter ();
301 formatter.Serialize (ms, item);
303 ListViewItem item2 = null;
306 item2 = (ListViewItem) formatter.Deserialize (ms);
307 Assert.AreEqual ("A", item2.Text, "#A1");
308 Assert.AreEqual ("A", item2.SubItems [0].Text, "#A2");
309 Assert.AreEqual ("B", item2.SubItems [1].Text, "#A3");
310 Assert.AreEqual ("C", item2.SubItems [2].Text, "#A4");
311 Assert.AreEqual (Color.AliceBlue, item2.BackColor, "#A4");
312 Assert.AreEqual (null, item2.ListView, "#A5");
313 Assert.AreEqual (Rectangle.Empty, item2.Bounds, "#A6");
314 Assert.AreEqual (item.Checked, item2.Checked, "#A7");
315 Assert.AreEqual (item.Font, item2.Font, "#A8");
316 Assert.AreEqual (item.ForeColor, item2.ForeColor, "#A9");
317 Assert.AreEqual (item.ImageIndex, item2.ImageIndex, "#A10");
318 Assert.AreEqual (-1, item2.Index, "#A11");
319 Assert.AreEqual (false, item2.Selected, "#A12");
320 Assert.AreEqual (null, item2.Tag, "#A13");
321 Assert.AreEqual (item.UseItemStyleForSubItems, item2.UseItemStyleForSubItems, "#A14");
322 Assert.AreEqual (item.ImageKey, item2.ImageKey, "#A15");
323 Assert.AreEqual (0, item2.IndentCount, "#A16");
324 Assert.AreEqual (String.Empty, item2.Name, "#A17");
325 Assert.AreEqual (new Point (-1, -1), item2.Position, "#A18");
326 Assert.AreEqual (String.Empty, item2.ToolTipText, "#A19");
327 Assert.AreEqual (item.Group.Header, item2.Group.Header, "#A20");
332 public void ListViewItemDefaultValues ()
334 ListViewItem item = new ListViewItem ();
336 Assert.IsFalse (item.Focused, "DefaultValues#3");
337 Assert.IsFalse (item.Checked, "DefaultValues#4");
338 Assert.AreEqual (string.Empty, item.Text, "DefaultValues#5");
339 Assert.IsTrue (item.UseItemStyleForSubItems, "DefaultValues#6");
340 Assert.AreEqual (-1, item.ImageIndex, "DefaultValues#7");
342 Assert.AreEqual (String.Empty, item.Name, "DefaultValues#8");
343 Assert.AreEqual(String.Empty, item.ImageKey, "DefaultValues#9");
344 Assert.AreEqual (String.Empty, item.ToolTipText, "DefaultValues#10");
345 Assert.AreEqual (0, item.IndentCount, "DefaultValues#11");
350 public void ListViewItemBackColor ()
352 ListViewItem item = new ListViewItem ();
354 ListView lv = new ListView ();
356 lv.BackColor = Color.Orange;
357 Assert.AreEqual (lv.BackColor, item.BackColor, "BackColor#1");
358 Assert.AreEqual (lv.BackColor, item.SubItems [0].BackColor, "BackColor#2");
360 item.BackColor = Color.Navy;
361 Assert.AreEqual (Color.Navy, item.BackColor, "BackColor#3");
362 Assert.AreEqual (Color.Navy, item.SubItems [0].BackColor, "BackColor#4");
364 item.SubItems [0].BackColor = Color.Green;
365 Assert.AreEqual (Color.Green, item.BackColor, "BackColor#5");
366 Assert.AreEqual (Color.Green, item.SubItems [0].BackColor, "BackColor#6");
370 public void ListViewItemForeColor ()
372 ListViewItem item = new ListViewItem ();
374 ListView lv = new ListView ();
376 lv.ForeColor = Color.Orange;
377 Assert.AreEqual (lv.ForeColor, item.ForeColor, "ForeColor#1");
378 Assert.AreEqual (lv.ForeColor, item.SubItems [0].ForeColor, "ForeColor#2");
380 item.ForeColor = Color.Navy;
381 Assert.AreEqual (Color.Navy, item.ForeColor, "ForeColor#3");
382 Assert.AreEqual (Color.Navy, item.SubItems [0].ForeColor, "ForeColor#4");
384 item.SubItems [0].ForeColor = Color.Green;
385 Assert.AreEqual (Color.Green, item.ForeColor, "ForeColor#5");
386 Assert.AreEqual (Color.Green, item.SubItems [0].ForeColor, "ForeColor#6");
390 public void ListViewItemFocused ()
392 ListView lv = new ListView ();
393 ListViewItem item1 = lv.Items.Add ("A");
394 ListViewItem item2 = lv.Items.Add ("B");
395 ListViewItem item3 = lv.Items.Add ("C");
398 Form form = new Form ();
402 item1.Focused = true;
403 Assert.IsTrue (item1.Focused, "#A1");
404 Assert.IsFalse (item2.Focused, "#A2");
405 Assert.IsFalse (item3.Focused, "#A3");
406 Assert.AreEqual (item1, lv.FocusedItem, "#A4");
408 item2.Focused = true;
409 Assert.IsFalse (item1.Focused, "#B1");
410 Assert.IsTrue (item2.Focused, "#B2");
411 Assert.IsFalse (item3.Focused, "#B3");
412 Assert.AreEqual (item2, lv.FocusedItem, "#B4");
414 item3.Focused = true;
415 Assert.IsFalse (item1.Focused, "#C1");
416 Assert.IsFalse (item2.Focused, "#C2");
417 Assert.IsTrue (item3.Focused, "#C3");
418 Assert.AreEqual (item3, lv.FocusedItem, "#C4");
420 item3.Focused = false;
421 Assert.IsFalse (item1.Focused, "#D1");
422 Assert.IsFalse (item2.Focused, "#D2");
423 Assert.IsFalse (item3.Focused, "#D3");
424 Assert.IsNull (lv.FocusedItem, "#D4");
426 // Test Focused for Items without owner
427 ListViewItem item4 = new ListViewItem ();
428 Assert.IsFalse (item4.Focused);
429 item4.Focused = true;
431 Assert.IsFalse (item4.Focused, "#E1");
438 [ExpectedException (typeof (ArgumentOutOfRangeException))]
439 public void ListViewItemIndent ()
441 ListViewItem item = new ListViewItem ();
442 item.IndentCount = -1;
446 public void ListViewItemPosition ()
448 ListViewItem itemA = new ListViewItem ();
449 ListViewItem itemB = new ListViewItem ();
450 Point initial_pos = new Point (-1, -1);
452 Assert.AreEqual (itemA.Position, initial_pos, "#A1");
453 Assert.AreEqual (itemB.Position, initial_pos, "#A2");
455 ListView lvw = new ListView ();
456 lvw.Items.AddRange (new ListViewItem [] { itemA, itemB });
458 Assert.AreEqual (itemA.Position, initial_pos, "#B1");
459 Assert.AreEqual (itemB.Position, initial_pos, "#B2");
461 // Create handle for lvw
462 lvw.CreateControl ();
464 Point itemA_pos = itemA.Position;
465 Point itemB_pos = itemB.Position;
467 Assert.IsTrue (itemA_pos != initial_pos, "#C1");
468 Assert.IsTrue (itemB_pos != initial_pos, "#C2");
473 Assert.AreEqual (itemA_pos, itemA.Position, "#D1");
474 Assert.AreEqual (itemB_pos, itemB.Position, "#D2");
476 // Add in reverse order
477 lvw.Items.AddRange (new ListViewItem [] { itemB, itemA });
479 Assert.IsTrue (itemA_pos != itemA.Position, "#E1");
480 Assert.IsTrue (itemB_pos != itemB.Position, "#E2");
482 // Remove from ListView
484 Assert.IsTrue (initial_pos != itemA.Position, "#F1");
485 Assert.IsTrue (initial_pos != itemB.Position, "#F2");
488 // Now add them in other view (no effect)
490 lvw.Items.AddRange (new ListViewItem [] { itemA, itemB });
491 lvw.Columns.Add ("Column A");
492 lvw.View = View.Details;
494 itemB_pos = itemB.Position;
495 Assert.IsTrue (Point.Empty != itemB_pos, "#G1");
496 Assert.IsTrue (initial_pos != itemB_pos, "#G2");
498 itemB.Position = Point.Empty;
499 Assert.AreEqual (itemB_pos, itemB.Position, "#H1");
503 [Test] // bug #330415 and #331643
504 public void RemoveFocusedItem ()
506 ListView lv = new ListView ();
507 ListViewItem itemA = lv.Items.Add ("ItemA");
508 ListViewItem itemB = lv.Items.Add ("ItemB");
509 ListViewItem itemC = lv.Items.Add ("ItemC");
510 ListViewItem itemD = lv.Items.Add ("ItemD");
512 Form form = new Form ();
513 form.ShowInTaskbar = false;
514 form.Controls.Add (lv);
517 // Calling Form.Show () doesn't fire
518 // GotFocus event on child controls (asynch messages),
519 // thus we can't get the first item focused,
520 // but we DO when calling Application.Run ()
522 //Assert.IsTrue (itemA.Focused, "#A1");
523 Assert.IsFalse (itemB.Focused, "#A2");
524 Assert.IsFalse (itemC.Focused, "#A3");
525 Assert.IsFalse (itemD.Focused, "#A4");
527 itemB.Focused = true;
529 Assert.IsFalse (itemA.Focused, "#B1");
530 Assert.IsTrue (itemB.Focused, "#B2");
531 Assert.IsFalse (itemC.Focused, "#B3");
532 Assert.IsFalse (itemD.Focused, "#B4");
534 lv.Items.Remove (itemB);
536 Assert.IsFalse (itemA.Focused, "#C1");
537 Assert.IsFalse (itemB.Focused, "#C2");
538 Assert.IsTrue (itemC.Focused, "#C3");
539 Assert.IsFalse (itemD.Focused, "#C4");
541 itemD.Focused = true;
543 Assert.IsFalse (itemA.Focused, "#D1");
544 Assert.IsFalse (itemB.Focused, "#D2");
545 Assert.IsFalse (itemC.Focused, "#D3");
546 Assert.IsTrue (itemD.Focused, "#D4");
548 lv.Items.Remove (itemD);
550 Assert.IsFalse (itemA.Focused, "#E1");
551 Assert.IsFalse (itemB.Focused, "#E2");
552 Assert.IsTrue (itemC.Focused, "#E3");
553 Assert.IsFalse (itemD.Focused, "#E4");
555 lv.Items.Remove (itemC);
557 Assert.IsTrue (itemA.Focused, "#F1");
558 Assert.IsFalse (itemB.Focused, "#F2");
559 Assert.IsFalse (itemC.Focused, "#F3");
560 Assert.IsFalse (itemD.Focused, "#F4");
562 lv.Items.Remove (itemA);
564 Assert.IsFalse (itemA.Focused, "#G1");
565 Assert.IsFalse (itemB.Focused, "#G2");
566 Assert.IsFalse (itemC.Focused, "#G3");
567 Assert.IsFalse (itemD.Focused, "#G4");
569 ListViewItem itemE = lv.Items.Add ("ItemE");
571 Assert.IsFalse (itemA.Focused, "#H1");
572 Assert.IsFalse (itemB.Focused, "#H2");
573 Assert.IsFalse (itemC.Focused, "#H3");
574 Assert.IsFalse (itemD.Focused, "#H4");
575 Assert.IsFalse (itemE.Focused, "#H5");
582 public void ListViewItemGroup ()
584 ListViewGroup lvg1 = new ListViewGroup ();
585 ListViewGroup lvg2 = new ListViewGroup ();
586 ListViewItem lvi = new ListViewItem ();
588 lvg1.Items.Add (lvi);
590 Assert.AreEqual (1, lvg1.Items.Count, "#A1");
591 Assert.AreEqual (lvg1, lvi.Group, "#A2");
594 Assert.AreEqual (0, lvg1.Items.Count, "#B1");
595 Assert.AreEqual (1, lvg2.Items.Count, "#B2");
596 Assert.AreEqual (lvg2, lvi.Group, "#B3");
601 public void ListViewItemUseItemStyleForSubItems ()
603 ListViewItem item = new ListViewItem ();
604 Assert.AreEqual (1, item.SubItems.Count);
606 // UseitemStyleForSubItems works at draw level
607 item.UseItemStyleForSubItems = true;
609 ListViewItem.ListViewSubItem subitem0 = item.SubItems [0];
610 Color subitem0_back_color = subitem0.BackColor = Color.Black;
611 Color subitem0_fore_color = subitem0.ForeColor = Color.White;
613 Assert.AreEqual (subitem0_back_color, item.SubItems [0].BackColor, "UseItemStyleForSubItems#1");
614 Assert.AreEqual (subitem0_fore_color, item.SubItems [0].ForeColor, "UseItemStyleForSubItems#2");
615 Assert.AreEqual (item.BackColor, item.SubItems [0].BackColor, "UseItemStyleForSubItems#3");
616 Assert.AreEqual (item.ForeColor, item.SubItems [0].ForeColor, "UseItemStyleForSubItems#4");
618 ListViewItem.ListViewSubItem subitem1 = item.SubItems.Add ("SubItem");
619 Color subitem1_back_color = subitem1.BackColor = Color.Blue;
620 Color subitem1_fore_color = subitem1.ForeColor = Color.Gray;
622 Assert.AreEqual (subitem1_back_color, subitem1.BackColor, "UseItemStyleForSubItem#5");
623 Assert.AreEqual (subitem1_fore_color, subitem1.ForeColor, "UseItemStyleForSubItem#6");
627 public void ListViewItemTestClone ()
629 Form f = new Form ();
630 ListView lv = new ListView ();
633 ListViewItem item1 = lv.Items.Add ("Hello");
634 item1.ForeColor = Color.Blue;
635 item1.BackColor = Color.Red;
636 item1.Font = new Font ("Arial", 14);
637 item1.SubItems.Add ("Element2");
639 item1.ToolTipText = item1.Text;
644 ListViewItem item2 = (ListViewItem) item1.Clone ();
645 Assert.AreEqual (Color.Blue, item2.ForeColor, "#1");
646 Assert.AreEqual (Color.Red, item2.BackColor, "#2");
647 Assert.AreEqual ("Hello", item2.Text, "#3");
648 Assert.AreEqual (item1.Font, item2.Font, "#4");
649 Assert.AreEqual (2, item2.SubItems.Count, "#5");
650 Assert.AreEqual ("Hello", item2.SubItems [0].Text, "#6");
651 Assert.AreEqual ("Element2", item2.SubItems[1].Text, "#7");
653 Assert.AreEqual (item1.ToolTipText, item2.ToolTipText, "#8");
655 // Focused is not copied
656 // These tests shoule be re-enabled when #333693
657 /*Assert.IsTrue (item1.Focused, "#9");
658 Assert.IsFalse (item2.Focused, "#10");*/
665 public void ListViewItemTestImageIndex()
667 ListViewItem item1 = new ListViewItem();
669 item1.ImageKey = "Key1";
670 item1.ImageIndex = 0;
671 Assert.AreEqual(String.Empty, item1.ImageKey, "ImageIndex#1");
673 item1.ImageIndex = 0;
674 item1.ImageKey = "Key1";
675 Assert.AreEqual (-1, item1.ImageIndex, "ImageIndex#2");
677 item1.ImageKey = "Key1";
678 item1.ImageIndex = -1;
679 Assert.AreEqual (String.Empty, item1.ImageKey, "ImageIndex#3");
681 item1.ImageIndex = 0;
682 item1.ImageKey = String.Empty;
683 Assert.AreEqual (-1, item1.ImageIndex, "ImageIndex#4");
687 public void ListViewItemToolTipText ()
689 ListViewItem item1 = new ListViewItem();
690 item1.ToolTipText = null;
691 Assert.AreEqual (String.Empty, item1.ToolTipText, "ToolTipText#1");
697 public class ListViewSubItemTest : TestHelper
700 public void Constructor1 ()
702 ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem ();
703 Assert.AreEqual (string.Empty, subItem.Text, "#1");
704 Assert.AreEqual (SystemColors.Window, subItem.BackColor, "#2");
705 Assert.AreEqual (SystemColors.WindowText, subItem.ForeColor, "#3");
707 Assert.AreEqual (SystemFonts.DefaultFont, subItem.Font, "#4");
711 [Test] // ctor (ListViewItem, String)
712 public void Constructor2 ()
714 ListViewItem.ListViewSubItem subItem;
715 ListViewItem item = new ListViewItem ();
717 subItem = new ListViewItem.ListViewSubItem (null, null);
718 Assert.IsNotNull (subItem.Font, "#A1");
720 Assert.AreEqual (string.Empty, subItem.Name, "#A2");
721 Assert.IsNull (subItem.Tag, "#A3");
723 Assert.AreEqual (String.Empty, subItem.Text, "#A4");
725 subItem = new ListViewItem.ListViewSubItem (item, "SubItem2");
726 Assert.IsNotNull (subItem.Font, "#B1");
728 Assert.AreEqual (string.Empty, subItem.Name, "#B2");
729 Assert.IsNull (subItem.Tag, "#B3");
731 Assert.AreEqual ("SubItem2", subItem.Text, "#B4");
734 [Test] // ctor (ListViewItem, String, Color, Color, Font)
735 public void Constructor3 ()
737 ListViewItem.ListViewSubItem subItem;
738 Font font = new Font ("Arial", 12);
739 ListViewItem item = new ListViewItem ();
741 subItem = new ListViewItem.ListViewSubItem (null, null,
742 Color.Blue, Color.Red, null);
743 Assert.AreEqual (Color.Red, subItem.BackColor, "#A1");
744 Assert.IsNotNull (subItem.Font, "#A2");
745 Assert.AreEqual (Color.Blue, subItem.ForeColor, "#A3");
747 Assert.AreEqual (string.Empty, subItem.Name, "#A4");
748 Assert.IsNull (subItem.Tag, "#A5");
750 Assert.AreEqual (string.Empty, subItem.Text, "#A6");
752 subItem = new ListViewItem.ListViewSubItem (item, "SubItem3",
753 Color.Blue, Color.Green, font);
754 Assert.AreEqual (Color.Green, subItem.BackColor, "#B1");
755 Assert.AreSame (font, subItem.Font, "#B2");
756 Assert.AreEqual (Color.Blue, subItem.ForeColor, "#B3");
758 Assert.AreEqual (string.Empty, subItem.Name, "#B4");
759 Assert.IsNull (subItem.Tag, "#B5");
761 Assert.AreEqual ("SubItem3", subItem.Text, "#B6");
768 ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem ();
769 subItem.Name = "foo";
770 Assert.AreEqual ("foo", subItem.Name, "#1");
772 Assert.AreEqual (string.Empty, subItem.Name, "#2");
773 subItem.Name = "bar";
774 Assert.AreEqual ("bar", subItem.Name, "#3");
775 subItem.Name = string.Empty;
776 Assert.AreEqual (string.Empty, subItem.Name, "#4");
777 subItem.Name = " \t ";
778 Assert.AreEqual (" \t ", subItem.Name, "#5");
784 ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem ();
786 Assert.AreEqual ("foo", subItem.Tag, "#1");
788 Assert.IsNull (subItem.Tag, "#2");
790 Assert.AreEqual (5, subItem.Tag, "#3");
797 ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem ();
798 subItem.Text = "foo";
799 Assert.AreEqual ("foo", subItem.Text, "#1");
801 Assert.AreEqual (string.Empty, subItem.Text, "#2");
802 subItem.Text = "bar";
803 Assert.AreEqual ("bar", subItem.Text, "#3");
804 subItem.Text = string.Empty;
805 Assert.AreEqual (string.Empty, subItem.Text, "#4");
806 subItem.Text = " \t ";
807 Assert.AreEqual (" \t ", subItem.Text, "#5");
811 public void Serialize ()
813 ListViewItem.ListViewSubItem subItem;
814 Font font = new Font ("Arial", 12);
815 ListViewItem item = new ListViewItem ();
817 subItem = new ListViewItem.ListViewSubItem (item,
818 "SubItemText", Color.Yellow, Color.Green,
821 subItem.Name = "foo";
825 MemoryStream ms = new MemoryStream ();
826 BinaryFormatter formatter = new BinaryFormatter ();
827 formatter.Serialize (ms, subItem);
830 subItem = (ListViewItem.ListViewSubItem)
831 formatter.Deserialize (ms);
833 Assert.AreEqual (Color.Green, subItem.BackColor, "#A1");
834 Assert.AreEqual (font, subItem.Font, "#A2");
835 Assert.AreEqual (Color.Yellow, subItem.ForeColor, "#A3");
837 Assert.AreEqual (string.Empty, subItem.Name, "#A4");
838 Assert.IsNull (subItem.Tag, "#A5");
840 Assert.AreEqual ("SubItemText", subItem.Text, "#A6");
843 byte [] ser = new byte [ms.Length];
844 ms.Read (ser, 0, ser.Length);
848 [Category ("NotDotNet")]
849 [Category ("NotWorking")] // fails on buildbot
850 public void SerializeExact_Mono ()
852 ListViewItem.ListViewSubItem subItem;
853 Font font = new Font ("Arial", 12);
854 ListViewItem item = new ListViewItem ();
856 subItem = new ListViewItem.ListViewSubItem (item,
857 "SubItemText", Color.Yellow, Color.Green,
860 subItem.Name = "foo";
864 MemoryStream ms = new MemoryStream ();
865 BinaryFormatter formatter = new BinaryFormatter ();
866 formatter.AssemblyFormat = FormatterAssemblyStyle.Full;
867 formatter.Serialize (ms, subItem);
870 byte [] ser = new byte [ms.Length];
871 ms.Read (ser, 0, ser.Length);
874 Assert.AreEqual (_serializedV20_Mono, ser);
876 Assert.AreEqual (_serializedV11_Mono, ser);
881 [Category ("NotWorking")]
882 public void SerializeExact_MS ()
884 ListViewItem.ListViewSubItem subItem;
885 Font font = new Font ("Arial", 12);
886 ListViewItem item = new ListViewItem ();
888 subItem = new ListViewItem.ListViewSubItem (item,
889 "SubItemText", Color.Yellow, Color.Green,
892 subItem.Name = "foo";
896 MemoryStream ms = new MemoryStream ();
897 BinaryFormatter formatter = new BinaryFormatter ();
898 formatter.Serialize (ms, subItem);
901 byte [] ser = new byte [ms.Length];
902 ms.Read (ser, 0, ser.Length);
905 Assert.AreEqual (_serializedV20_MS, ser);
907 Assert.AreEqual (_serializedV11_MS, ser);
912 public void Deserialize ()
914 ListViewItem.ListViewSubItem subItem;
916 BinaryFormatter formatter = new BinaryFormatter ();
918 ms = new MemoryStream ();
919 ms.Write (_serializedV11_Mono, 0, _serializedV11_Mono.Length);
922 subItem = (ListViewItem.ListViewSubItem)
923 formatter.Deserialize (ms);
925 // FIXME: bug #410693
926 //Assert.AreEqual (Color.Green, subItem.BackColor, "#A1");
927 Assert.AreEqual ("Green", subItem.BackColor.Name, "#A1");
928 Assert.IsNotNull (subItem.Font, "#A2");
929 // FIXME: bug #410693
930 //Assert.AreEqual (Color.Yellow, subItem.ForeColor, "#A3");
931 Assert.AreEqual ("Yellow", subItem.ForeColor.Name, "#A3");
933 Assert.AreEqual (string.Empty, subItem.Name, "#A4");
934 Assert.IsNull (subItem.Tag, "#A5");
936 Assert.AreEqual ("SubItemText", subItem.Text, "#A6");
938 ms = new MemoryStream ();
939 ms.Write (_serializedV11_MS, 0, _serializedV11_MS.Length);
942 subItem = (ListViewItem.ListViewSubItem)
943 formatter.Deserialize (ms);
945 // FIXME: bug #410693
946 //Assert.AreEqual (Color.Green, subItem.BackColor, "#B1");
947 Assert.AreEqual ("Green", subItem.BackColor.Name, "#B1");
948 Assert.IsNotNull (subItem.Font, "#B2");
949 // FIXME: bug #410693
950 //Assert.AreEqual (Color.Yellow, subItem.ForeColor, "#B3");
951 Assert.AreEqual ("Yellow", subItem.ForeColor.Name, "#B3");
953 Assert.AreEqual (string.Empty, subItem.Name, "#B4");
954 Assert.IsNull (subItem.Tag, "#B5");
956 Assert.AreEqual ("SubItemText", subItem.Text, "#B6");
959 ms = new MemoryStream ();
960 ms.Write (_serializedV20_Mono, 0, _serializedV20_Mono.Length);
963 subItem = (ListViewItem.ListViewSubItem)
964 formatter.Deserialize (ms);
966 // FIXME: bug #410693
967 //Assert.AreEqual (Color.Green, subItem.BackColor, "#C1");
968 Assert.AreEqual ("Green", subItem.BackColor.Name, "#C1");
969 Assert.IsNotNull (subItem.Font, "#C2");
970 // FIXME: bug #410693
971 //Assert.AreEqual (Color.Yellow, subItem.ForeColor, "#C3");
972 Assert.AreEqual ("Yellow", subItem.ForeColor.Name, "#C3");
973 Assert.AreEqual (string.Empty, subItem.Name, "#C4");
974 Assert.IsNull (subItem.Tag, "#C5");
975 Assert.AreEqual ("SubItemText", subItem.Text, "#C6");
977 ms = new MemoryStream ();
978 ms.Write (_serializedV20_MS, 0, _serializedV20_MS.Length);
981 subItem = (ListViewItem.ListViewSubItem)
982 formatter.Deserialize (ms);
984 // FIXME: bug #410693
985 //Assert.AreEqual (Color.Green, subItem.BackColor, "#D1");
986 Assert.AreEqual ("Green", subItem.BackColor.Name, "#D1");
987 Assert.IsNotNull (subItem.Font, "#D2");
988 // FIXME: bug #410693
989 //Assert.AreEqual (Color.Yellow, subItem.ForeColor, "#D3");
990 Assert.AreEqual ("Yellow", subItem.ForeColor.Name, "#D3");
991 Assert.AreEqual (string.Empty, subItem.Name, "#D4");
992 Assert.IsNull (subItem.Tag, "#D5");
993 Assert.AreEqual ("SubItemText", subItem.Text, "#D6");
997 static byte [] _serializedV11_MS = {
998 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
999 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00,
1000 0x5a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e,
1001 0x64, 0x6f, 0x77, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2c,
1002 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e,
1003 0x30, 0x2e, 0x35, 0x30, 0x30, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x43,
1004 0x75, 0x6c, 0x74, 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65, 0x75, 0x74,
1005 0x72, 0x61, 0x6c, 0x2c, 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
1006 0x4b, 0x65, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d, 0x62, 0x37,
1007 0x37, 0x61, 0x35, 0x63, 0x35, 0x36, 0x31, 0x39, 0x33, 0x34, 0x65,
1008 0x30, 0x38, 0x39, 0x05, 0x01, 0x00, 0x00, 0x00, 0x31, 0x53, 0x79,
1009 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77,
1010 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x4c, 0x69, 0x73,
1011 0x74, 0x56, 0x69, 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x4c,
1012 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x53, 0x75, 0x62, 0x49,
1013 0x74, 0x65, 0x6d, 0x02, 0x00, 0x00, 0x00, 0x04, 0x74, 0x65, 0x78,
1014 0x74, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x01, 0x04, 0x3e, 0x53,
1015 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e, 0x64, 0x6f,
1016 0x77, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x4c, 0x69,
1017 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d, 0x2b,
1018 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x53, 0x75, 0x62,
1019 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x53, 0x75, 0x62, 0x49, 0x74, 0x65,
1020 0x6d, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x02, 0x00, 0x00, 0x00, 0x02,
1021 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x53, 0x75,
1022 0x62, 0x49, 0x74, 0x65, 0x6d, 0x54, 0x65, 0x78, 0x74, 0x09, 0x04,
1023 0x00, 0x00, 0x00, 0x0c, 0x05, 0x00, 0x00, 0x00, 0x54, 0x53, 0x79,
1024 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e,
1025 0x67, 0x2c, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d,
1026 0x31, 0x2e, 0x30, 0x2e, 0x35, 0x30, 0x30, 0x30, 0x2e, 0x30, 0x2c,
1027 0x20, 0x43, 0x75, 0x6c, 0x74, 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65,
1028 0x75, 0x74, 0x72, 0x61, 0x6c, 0x2c, 0x20, 0x50, 0x75, 0x62, 0x6c,
1029 0x69, 0x63, 0x4b, 0x65, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d,
1030 0x62, 0x30, 0x33, 0x66, 0x35, 0x66, 0x37, 0x66, 0x31, 0x31, 0x64,
1031 0x35, 0x30, 0x61, 0x33, 0x61, 0x05, 0x04, 0x00, 0x00, 0x00, 0x3e,
1032 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e, 0x64,
1033 0x6f, 0x77, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x4c,
1034 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d,
1035 0x2b, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x53, 0x75,
1036 0x62, 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x53, 0x75, 0x62, 0x49, 0x74,
1037 0x65, 0x6d, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x03, 0x00, 0x00, 0x00,
1038 0x09, 0x62, 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x09,
1039 0x66, 0x6f, 0x72, 0x65, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x04, 0x66,
1040 0x6f, 0x6e, 0x74, 0x04, 0x04, 0x04, 0x14, 0x53, 0x79, 0x73, 0x74,
1041 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e,
1042 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x05, 0x00, 0x00, 0x00, 0x14, 0x53,
1043 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69,
1044 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x05, 0x00, 0x00,
1045 0x00, 0x13, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72,
1046 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x6f, 0x6e, 0x74, 0x05,
1047 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0xfa, 0xff, 0xff,
1048 0xff, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72,
1049 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
1050 0x04, 0x00, 0x00, 0x00, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x0a,
1051 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x05,
1052 0x73, 0x74, 0x61, 0x74, 0x65, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x00,
1053 0x00, 0x00, 0x01, 0x09, 0x07, 0x07, 0x05, 0x00, 0x00, 0x00, 0x00,
1054 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x01, 0x00,
1055 0x0a, 0x01, 0xf9, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 0x00,
1056 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x01, 0x00,
1057 0x0a, 0x09, 0x08, 0x00, 0x00, 0x00, 0x05, 0x08, 0x00, 0x00, 0x00,
1058 0x13, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61,
1059 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x6f, 0x6e, 0x74, 0x04, 0x00,
1060 0x00, 0x00, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x04, 0x53, 0x69, 0x7a,
1061 0x65, 0x05, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x04, 0x55, 0x6e, 0x69,
1062 0x74, 0x01, 0x00, 0x04, 0x04, 0x0b, 0x18, 0x53, 0x79, 0x73, 0x74,
1063 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e,
1064 0x46, 0x6f, 0x6e, 0x74, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x05, 0x00,
1065 0x00, 0x00, 0x1b, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44,
1066 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x47, 0x72, 0x61, 0x70,
1067 0x68, 0x69, 0x63, 0x73, 0x55, 0x6e, 0x69, 0x74, 0x05, 0x00, 0x00,
1068 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x09, 0x00, 0x00, 0x00, 0x05,
1069 0x41, 0x72, 0x69, 0x61, 0x6c, 0x00, 0x00, 0x40, 0x41, 0x05, 0xf6,
1070 0xff, 0xff, 0xff, 0x18, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e,
1071 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x6f, 0x6e,
1072 0x74, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x01, 0x00, 0x00, 0x00, 0x07,
1073 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x5f, 0x00, 0x08, 0x05, 0x00,
1074 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xf5, 0xff, 0xff, 0xff,
1075 0x1b, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61,
1076 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69,
1077 0x63, 0x73, 0x55, 0x6e, 0x69, 0x74, 0x01, 0x00, 0x00, 0x00, 0x07,
1078 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x5f, 0x00, 0x08, 0x05, 0x00,
1079 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b };
1081 static byte [] _serializedV20_MS = {
1082 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
1083 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00,
1084 0x57, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e,
1085 0x64, 0x6f, 0x77, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2c,
1086 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x32, 0x2e,
1087 0x30, 0x2e, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x43, 0x75, 0x6c, 0x74,
1088 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c,
1089 0x2c, 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79,
1090 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d, 0x62, 0x37, 0x37, 0x61, 0x35,
1091 0x63, 0x35, 0x36, 0x31, 0x39, 0x33, 0x34, 0x65, 0x30, 0x38, 0x39,
1092 0x05, 0x01, 0x00, 0x00, 0x00, 0x31, 0x53, 0x79, 0x73, 0x74, 0x65,
1093 0x6d, 0x2e, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x2e, 0x46,
1094 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69,
1095 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x4c, 0x69, 0x73, 0x74,
1096 0x56, 0x69, 0x65, 0x77, 0x53, 0x75, 0x62, 0x49, 0x74, 0x65, 0x6d,
1097 0x04, 0x00, 0x00, 0x00, 0x04, 0x74, 0x65, 0x78, 0x74, 0x04, 0x6e,
1098 0x61, 0x6d, 0x65, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x08, 0x75,
1099 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x01, 0x01, 0x04, 0x02,
1100 0x3e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e,
1101 0x64, 0x6f, 0x77, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2e,
1102 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x49, 0x74, 0x65,
1103 0x6d, 0x2b, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x53,
1104 0x75, 0x62, 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x53, 0x75, 0x62, 0x49,
1105 0x74, 0x65, 0x6d, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x02, 0x00, 0x00,
1106 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x00, 0x0b,
1107 0x53, 0x75, 0x62, 0x49, 0x74, 0x65, 0x6d, 0x54, 0x65, 0x78, 0x74,
1108 0x06, 0x04, 0x00, 0x00, 0x00, 0x03, 0x66, 0x6f, 0x6f, 0x09, 0x05,
1109 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x03, 0x62, 0x61,
1110 0x72, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x51, 0x53, 0x79, 0x73, 0x74,
1111 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2c,
1112 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x32, 0x2e,
1113 0x30, 0x2e, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x43, 0x75, 0x6c, 0x74,
1114 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c,
1115 0x2c, 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79,
1116 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d, 0x62, 0x30, 0x33, 0x66, 0x35,
1117 0x66, 0x37, 0x66, 0x31, 0x31, 0x64, 0x35, 0x30, 0x61, 0x33, 0x61,
1118 0x05, 0x05, 0x00, 0x00, 0x00, 0x3e, 0x53, 0x79, 0x73, 0x74, 0x65,
1119 0x6d, 0x2e, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x2e, 0x46,
1120 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69,
1121 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x4c, 0x69, 0x73, 0x74,
1122 0x56, 0x69, 0x65, 0x77, 0x53, 0x75, 0x62, 0x49, 0x74, 0x65, 0x6d,
1123 0x2b, 0x53, 0x75, 0x62, 0x49, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x79,
1124 0x6c, 0x65, 0x03, 0x00, 0x00, 0x00, 0x09, 0x62, 0x61, 0x63, 0x6b,
1125 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x09, 0x66, 0x6f, 0x72, 0x65, 0x43,
1126 0x6f, 0x6c, 0x6f, 0x72, 0x04, 0x66, 0x6f, 0x6e, 0x74, 0x04, 0x04,
1127 0x04, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72,
1128 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
1129 0x07, 0x00, 0x00, 0x00, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d,
1130 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f,
1131 0x6c, 0x6f, 0x72, 0x07, 0x00, 0x00, 0x00, 0x13, 0x53, 0x79, 0x73,
1132 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67,
1133 0x2e, 0x46, 0x6f, 0x6e, 0x74, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00,
1134 0x00, 0x00, 0x05, 0xf8, 0xff, 0xff, 0xff, 0x14, 0x53, 0x79, 0x73,
1135 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67,
1136 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x04, 0x00, 0x00, 0x00, 0x04,
1137 0x6e, 0x61, 0x6d, 0x65, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x0a,
1138 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x05,
1139 0x73, 0x74, 0x61, 0x74, 0x65, 0x01, 0x00, 0x00, 0x00, 0x09, 0x07,
1140 0x07, 0x07, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
1141 0x00, 0x00, 0x00, 0x4f, 0x00, 0x01, 0x00, 0x01, 0xf7, 0xff, 0xff,
1142 0xff, 0xf8, 0xff, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
1143 0x00, 0x00, 0x00, 0xa6, 0x00, 0x01, 0x00, 0x09, 0x0a, 0x00, 0x00,
1144 0x00, 0x05, 0x0a, 0x00, 0x00, 0x00, 0x13, 0x53, 0x79, 0x73, 0x74,
1145 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e,
1146 0x46, 0x6f, 0x6e, 0x74, 0x04, 0x00, 0x00, 0x00, 0x04, 0x4e, 0x61,
1147 0x6d, 0x65, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x05, 0x53, 0x74, 0x79,
1148 0x6c, 0x65, 0x04, 0x55, 0x6e, 0x69, 0x74, 0x01, 0x00, 0x04, 0x04,
1149 0x0b, 0x18, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72,
1150 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x6f, 0x6e, 0x74, 0x53,
1151 0x74, 0x79, 0x6c, 0x65, 0x07, 0x00, 0x00, 0x00, 0x1b, 0x53, 0x79,
1152 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e,
1153 0x67, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x55,
1154 0x6e, 0x69, 0x74, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
1155 0x06, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x41, 0x72, 0x69, 0x61, 0x6c,
1156 0x00, 0x00, 0x40, 0x41, 0x05, 0xf4, 0xff, 0xff, 0xff, 0x18, 0x53,
1157 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69,
1158 0x6e, 0x67, 0x2e, 0x46, 0x6f, 0x6e, 0x74, 0x53, 0x74, 0x79, 0x6c,
1159 0x65, 0x01, 0x00, 0x00, 0x00, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65,
1160 0x5f, 0x5f, 0x00, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1161 0x00, 0x05, 0xf3, 0xff, 0xff, 0xff, 0x1b, 0x53, 0x79, 0x73, 0x74,
1162 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e,
1163 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x55, 0x6e, 0x69,
1164 0x74, 0x01, 0x00, 0x00, 0x00, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65,
1165 0x5f, 0x5f, 0x00, 0x08, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
1168 static byte [] _serializedV11_Mono = {
1169 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
1170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00,
1171 0x5a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e,
1172 0x64, 0x6f, 0x77, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2c,
1173 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e,
1174 0x30, 0x2e, 0x35, 0x30, 0x30, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x43,
1175 0x75, 0x6c, 0x74, 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65, 0x75, 0x74,
1176 0x72, 0x61, 0x6c, 0x2c, 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
1177 0x4b, 0x65, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d, 0x62, 0x37,
1178 0x37, 0x61, 0x35, 0x63, 0x35, 0x36, 0x31, 0x39, 0x33, 0x34, 0x65,
1179 0x30, 0x38, 0x39, 0x05, 0x01, 0x00, 0x00, 0x00, 0x31, 0x53, 0x79,
1180 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77,
1181 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x4c, 0x69, 0x73,
1182 0x74, 0x56, 0x69, 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x4c,
1183 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x53, 0x75, 0x62, 0x49,
1184 0x74, 0x65, 0x6d, 0x02, 0x00, 0x00, 0x00, 0x04, 0x74, 0x65, 0x78,
1185 0x74, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x01, 0x04, 0x3e, 0x53,
1186 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e, 0x64, 0x6f,
1187 0x77, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x4c, 0x69,
1188 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d, 0x2b,
1189 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x53, 0x75, 0x62,
1190 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x53, 0x75, 0x62, 0x49, 0x74, 0x65,
1191 0x6d, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x02, 0x00, 0x00, 0x00, 0x02,
1192 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x53, 0x75,
1193 0x62, 0x49, 0x74, 0x65, 0x6d, 0x54, 0x65, 0x78, 0x74, 0x09, 0x04,
1194 0x00, 0x00, 0x00, 0x0c, 0x05, 0x00, 0x00, 0x00, 0x54, 0x53, 0x79,
1195 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e,
1196 0x67, 0x2c, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d,
1197 0x31, 0x2e, 0x30, 0x2e, 0x35, 0x30, 0x30, 0x30, 0x2e, 0x30, 0x2c,
1198 0x20, 0x43, 0x75, 0x6c, 0x74, 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65,
1199 0x75, 0x74, 0x72, 0x61, 0x6c, 0x2c, 0x20, 0x50, 0x75, 0x62, 0x6c,
1200 0x69, 0x63, 0x4b, 0x65, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d,
1201 0x62, 0x30, 0x33, 0x66, 0x35, 0x66, 0x37, 0x66, 0x31, 0x31, 0x64,
1202 0x35, 0x30, 0x61, 0x33, 0x61, 0x05, 0x04, 0x00, 0x00, 0x00, 0x3e,
1203 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e, 0x64,
1204 0x6f, 0x77, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x4c,
1205 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d,
1206 0x2b, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x53, 0x75,
1207 0x62, 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x53, 0x75, 0x62, 0x49, 0x74,
1208 0x65, 0x6d, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x03, 0x00, 0x00, 0x00,
1209 0x09, 0x62, 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x09,
1210 0x66, 0x6f, 0x72, 0x65, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x04, 0x66,
1211 0x6f, 0x6e, 0x74, 0x04, 0x04, 0x04, 0x14, 0x53, 0x79, 0x73, 0x74,
1212 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e,
1213 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x05, 0x00, 0x00, 0x00, 0x14, 0x53,
1214 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69,
1215 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x05, 0x00, 0x00,
1216 0x00, 0x13, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72,
1217 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x6f, 0x6e, 0x74, 0x05,
1218 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x06, 0x00, 0x00,
1219 0x00, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72,
1220 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
1221 0x04, 0x00, 0x00, 0x00, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x05,
1222 0x73, 0x74, 0x61, 0x74, 0x65, 0x0a, 0x6b, 0x6e, 0x6f, 0x77, 0x6e,
1223 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x00,
1224 0x00, 0x00, 0x01, 0x09, 0x07, 0x07, 0x05, 0x00, 0x00, 0x00, 0x00,
1225 0x80, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x4f, 0x00,
1226 0x06, 0x07, 0x00, 0x00, 0x00, 0x05, 0x47, 0x72, 0x65, 0x65, 0x6e,
1227 0x01, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xff,
1228 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0xa6, 0x00, 0x06,
1229 0x09, 0x00, 0x00, 0x00, 0x06, 0x59, 0x65, 0x6c, 0x6c, 0x6f, 0x77,
1230 0x09, 0x0a, 0x00, 0x00, 0x00, 0x05, 0x0a, 0x00, 0x00, 0x00, 0x13,
1231 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77,
1232 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x6f, 0x6e, 0x74, 0x04, 0x00, 0x00,
1233 0x00, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x04, 0x53, 0x69, 0x7a, 0x65,
1234 0x05, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x04, 0x55, 0x6e, 0x69, 0x74,
1235 0x01, 0x00, 0x04, 0x04, 0x0b, 0x18, 0x53, 0x79, 0x73, 0x74, 0x65,
1236 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x46,
1237 0x6f, 0x6e, 0x74, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x05, 0x00, 0x00,
1238 0x00, 0x1b, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72,
1239 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68,
1240 0x69, 0x63, 0x73, 0x55, 0x6e, 0x69, 0x74, 0x05, 0x00, 0x00, 0x00,
1241 0x05, 0x00, 0x00, 0x00, 0x06, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x41,
1242 0x72, 0x69, 0x61, 0x6c, 0x00, 0x00, 0x40, 0x41, 0x05, 0x0c, 0x00,
1243 0x00, 0x00, 0x18, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44,
1244 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x6f, 0x6e, 0x74,
1245 0x53, 0x74, 0x79, 0x6c, 0x65, 0x01, 0x00, 0x00, 0x00, 0x07, 0x76,
1246 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x5f, 0x00, 0x08, 0x05, 0x00, 0x00,
1247 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0d, 0x00, 0x00, 0x00, 0x1b,
1248 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77,
1249 0x69, 0x6e, 0x67, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63,
1250 0x73, 0x55, 0x6e, 0x69, 0x74, 0x01, 0x00, 0x00, 0x00, 0x07, 0x76,
1251 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x5f, 0x00, 0x08, 0x05, 0x00, 0x00,
1252 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b };
1254 static byte [] _serializedV20_Mono = {
1255 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
1256 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00,
1257 0x57, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e,
1258 0x64, 0x6f, 0x77, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2c,
1259 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x32, 0x2e,
1260 0x30, 0x2e, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x43, 0x75, 0x6c, 0x74,
1261 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c,
1262 0x2c, 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79,
1263 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d, 0x62, 0x37, 0x37, 0x61, 0x35,
1264 0x63, 0x35, 0x36, 0x31, 0x39, 0x33, 0x34, 0x65, 0x30, 0x38, 0x39,
1265 0x05, 0x01, 0x00, 0x00, 0x00, 0x31, 0x53, 0x79, 0x73, 0x74, 0x65,
1266 0x6d, 0x2e, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x2e, 0x46,
1267 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69,
1268 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x4c, 0x69, 0x73, 0x74,
1269 0x56, 0x69, 0x65, 0x77, 0x53, 0x75, 0x62, 0x49, 0x74, 0x65, 0x6d,
1270 0x04, 0x00, 0x00, 0x00, 0x04, 0x74, 0x65, 0x78, 0x74, 0x04, 0x6e,
1271 0x61, 0x6d, 0x65, 0x08, 0x75, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74,
1272 0x61, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x01, 0x01, 0x02, 0x04,
1273 0x3e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x69, 0x6e,
1274 0x64, 0x6f, 0x77, 0x73, 0x2e, 0x46, 0x6f, 0x72, 0x6d, 0x73, 0x2e,
1275 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x49, 0x74, 0x65,
1276 0x6d, 0x2b, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69, 0x65, 0x77, 0x53,
1277 0x75, 0x62, 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x53, 0x75, 0x62, 0x49,
1278 0x74, 0x65, 0x6d, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x02, 0x00, 0x00,
1279 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x00, 0x0b,
1280 0x53, 0x75, 0x62, 0x49, 0x74, 0x65, 0x6d, 0x54, 0x65, 0x78, 0x74,
1281 0x06, 0x04, 0x00, 0x00, 0x00, 0x03, 0x66, 0x6f, 0x6f, 0x06, 0x05,
1282 0x00, 0x00, 0x00, 0x03, 0x62, 0x61, 0x72, 0x09, 0x06, 0x00, 0x00,
1283 0x00, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x51, 0x53, 0x79, 0x73, 0x74,
1284 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2c,
1285 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x32, 0x2e,
1286 0x30, 0x2e, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x43, 0x75, 0x6c, 0x74,
1287 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c,
1288 0x2c, 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79,
1289 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d, 0x62, 0x30, 0x33, 0x66, 0x35,
1290 0x66, 0x37, 0x66, 0x31, 0x31, 0x64, 0x35, 0x30, 0x61, 0x33, 0x61,
1291 0x05, 0x06, 0x00, 0x00, 0x00, 0x3e, 0x53, 0x79, 0x73, 0x74, 0x65,
1292 0x6d, 0x2e, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73, 0x2e, 0x46,
1293 0x6f, 0x72, 0x6d, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69,
1294 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d, 0x2b, 0x4c, 0x69, 0x73, 0x74,
1295 0x56, 0x69, 0x65, 0x77, 0x53, 0x75, 0x62, 0x49, 0x74, 0x65, 0x6d,
1296 0x2b, 0x53, 0x75, 0x62, 0x49, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x79,
1297 0x6c, 0x65, 0x03, 0x00, 0x00, 0x00, 0x09, 0x62, 0x61, 0x63, 0x6b,
1298 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x09, 0x66, 0x6f, 0x72, 0x65, 0x43,
1299 0x6f, 0x6c, 0x6f, 0x72, 0x04, 0x66, 0x6f, 0x6e, 0x74, 0x04, 0x04,
1300 0x04, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72,
1301 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
1302 0x07, 0x00, 0x00, 0x00, 0x14, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d,
1303 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f,
1304 0x6c, 0x6f, 0x72, 0x07, 0x00, 0x00, 0x00, 0x13, 0x53, 0x79, 0x73,
1305 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67,
1306 0x2e, 0x46, 0x6f, 0x6e, 0x74, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00,
1307 0x00, 0x00, 0x05, 0x08, 0x00, 0x00, 0x00, 0x14, 0x53, 0x79, 0x73,
1308 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67,
1309 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x04, 0x00, 0x00, 0x00, 0x05,
1310 0x76, 0x61, 0x6c, 0x75, 0x65, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65,
1311 0x0a, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
1312 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, 0x00, 0x01, 0x09, 0x07,
1313 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0xff, 0x00, 0x00,
1314 0x00, 0x00, 0x07, 0x00, 0x4f, 0x00, 0x06, 0x09, 0x00, 0x00, 0x00,
1315 0x05, 0x47, 0x72, 0x65, 0x65, 0x6e, 0x01, 0x0a, 0x00, 0x00, 0x00,
1316 0x08, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
1317 0x00, 0x07, 0x00, 0xa6, 0x00, 0x06, 0x0b, 0x00, 0x00, 0x00, 0x06,
1318 0x59, 0x65, 0x6c, 0x6c, 0x6f, 0x77, 0x09, 0x0c, 0x00, 0x00, 0x00,
1319 0x05, 0x0c, 0x00, 0x00, 0x00, 0x13, 0x53, 0x79, 0x73, 0x74, 0x65,
1320 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x46,
1321 0x6f, 0x6e, 0x74, 0x04, 0x00, 0x00, 0x00, 0x04, 0x4e, 0x61, 0x6d,
1322 0x65, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x05, 0x53, 0x74, 0x79, 0x6c,
1323 0x65, 0x04, 0x55, 0x6e, 0x69, 0x74, 0x01, 0x00, 0x04, 0x04, 0x0b,
1324 0x18, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61,
1325 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x46, 0x6f, 0x6e, 0x74, 0x53, 0x74,
1326 0x79, 0x6c, 0x65, 0x07, 0x00, 0x00, 0x00, 0x1b, 0x53, 0x79, 0x73,
1327 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67,
1328 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x55, 0x6e,
1329 0x69, 0x74, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06,
1330 0x0d, 0x00, 0x00, 0x00, 0x05, 0x41, 0x72, 0x69, 0x61, 0x6c, 0x00,
1331 0x00, 0x40, 0x41, 0x05, 0x0e, 0x00, 0x00, 0x00, 0x18, 0x53, 0x79,
1332 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e,
1333 0x67, 0x2e, 0x46, 0x6f, 0x6e, 0x74, 0x53, 0x74, 0x79, 0x6c, 0x65,
1334 0x01, 0x00, 0x00, 0x00, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f,
1335 0x5f, 0x00, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1336 0x05, 0x0f, 0x00, 0x00, 0x00, 0x1b, 0x53, 0x79, 0x73, 0x74, 0x65,
1337 0x6d, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x69, 0x6e, 0x67, 0x2e, 0x47,
1338 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x55, 0x6e, 0x69, 0x74,
1339 0x01, 0x00, 0x00, 0x00, 0x07, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f,
1340 0x5f, 0x00, 0x08, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1345 public class ListViewSubItemCollectionTest : TestHelper
1350 ListViewItem item = new ListViewItem ();
1353 ListViewItem.ListViewSubItemCollection sub_items;
1354 sub_items = new ListViewItem.ListViewSubItemCollection (item);
1356 Assert.AreEqual (1, sub_items.Count, "#A1");
1357 Assert.AreEqual ("MAIN", sub_items [0].Text, "#A2");
1359 sub_items.Add ("A");
1361 Assert.AreEqual (2, sub_items.Count, "#B1");
1362 Assert.AreEqual ("A", sub_items [1].Text, "#B2");
1366 public void AddRange1 ()
1368 ListViewItem item = new ListViewItem ();
1369 ListViewItem.ListViewSubItem subItemA = item.SubItems.Add ("A");
1371 Assert.AreEqual (2, item.SubItems.Count, "#A1");
1372 Assert.IsNotNull (item.SubItems [0], "#A2");
1373 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#A3");
1375 ListViewItem.ListViewSubItem subItemB = new ListViewItem.ListViewSubItem ();
1376 subItemB.Text = "B";
1377 ListViewItem.ListViewSubItem subItemC = new ListViewItem.ListViewSubItem ();
1378 subItemB.Text = "C";
1380 item.SubItems.AddRange (new ListViewItem.ListViewSubItem [] {
1381 subItemB, null, subItemC });
1382 Assert.AreEqual (4, item.SubItems.Count, "#B1");
1383 Assert.IsNotNull (item.SubItems [0], "#B2");
1384 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#B3");
1385 Assert.IsNotNull (item.SubItems [1], "#B3");
1386 Assert.AreSame (subItemA, item.SubItems [1], "#B4");
1387 Assert.IsNotNull (item.SubItems [2], "#B5");
1388 Assert.AreSame (subItemB, item.SubItems [2], "#B6");
1389 Assert.IsNotNull (item.SubItems [3], "#B7");
1390 Assert.AreSame (subItemC, item.SubItems [3], "#B8");
1394 public void AddRange1_Null ()
1396 ListViewItem item = new ListViewItem ();
1398 item.SubItems.AddRange ((ListViewItem.ListViewSubItem []) null);
1400 } catch (ArgumentNullException ex) {
1401 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1402 Assert.IsNotNull (ex.Message, "#3");
1403 Assert.IsNotNull (ex.ParamName, "#4");
1404 Assert.AreEqual ("items", ex.ParamName, "#5");
1405 Assert.IsNull (ex.InnerException, "#6");
1410 public void AddRange2 ()
1412 string subItemAText = "A";
1413 string subItemBText = "B";
1414 string subItemCText = "B";
1416 ListViewItem item = new ListViewItem ();
1417 item.SubItems.Add (subItemAText);
1419 Assert.AreEqual (2, item.SubItems.Count, "#A1");
1420 Assert.IsNotNull (item.SubItems [0], "#A2");
1421 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#A3");
1422 Assert.IsNotNull (item.SubItems [1], "#A4");
1423 Assert.AreEqual (subItemAText, item.SubItems [1].Text, "#A5");
1425 item.SubItems.AddRange (new string [] { subItemBText, null, subItemCText });
1426 Assert.AreEqual (4, item.SubItems.Count, "#B1");
1427 Assert.IsNotNull (item.SubItems [0], "#B2");
1428 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#B3");
1429 Assert.IsNotNull (item.SubItems [1], "#B4");
1430 Assert.AreSame (subItemAText, item.SubItems [1].Text, "#B5");
1431 Assert.IsNotNull (item.SubItems [2], "#B6");
1432 Assert.AreSame (subItemBText, item.SubItems [2].Text, "#B7");
1433 Assert.IsNotNull (item.SubItems [3], "#B8");
1434 Assert.AreSame (subItemCText, item.SubItems [3].Text, "#B9");
1438 public void AddRange2_Null ()
1440 ListViewItem item = new ListViewItem ();
1442 item.SubItems.AddRange ((string []) null);
1444 } catch (ArgumentNullException ex) {
1445 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1446 Assert.IsNotNull (ex.Message, "#3");
1447 Assert.IsNotNull (ex.ParamName, "#4");
1448 Assert.AreEqual ("items", ex.ParamName, "#5");
1449 Assert.IsNull (ex.InnerException, "#6");
1454 public void AddRange3 ()
1456 string subItemAText = "A";
1457 string subItemBText = "B";
1458 string subItemCText = "B";
1459 Font font = new Font ("Arial", 14);
1461 ListViewItem item = new ListViewItem ();
1462 item.SubItems.Add (subItemAText);
1464 Assert.AreEqual (2, item.SubItems.Count, "#A1");
1465 Assert.IsNotNull (item.SubItems [0], "#A2");
1466 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#A3");
1467 Assert.IsNotNull (item.SubItems [1], "#A4");
1468 Assert.AreEqual (subItemAText, item.SubItems [1].Text, "#A5");
1470 item.SubItems.AddRange (new string [] { subItemBText, null, subItemCText },
1471 Color.Blue, Color.Red, font);
1472 Assert.AreEqual (4, item.SubItems.Count, "#B1");
1473 Assert.IsNotNull (item.SubItems [0], "#B2");
1474 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#B3");
1475 Assert.IsNotNull (item.SubItems [1], "#C1");
1476 Assert.AreSame (subItemAText, item.SubItems [1].Text, "#C2");
1477 Assert.IsNotNull (item.SubItems [2], "#D1");
1478 Assert.AreSame (subItemBText, item.SubItems [2].Text, "#D2");
1479 Assert.AreEqual (Color.Blue, item.SubItems [2].ForeColor, "#D3");
1480 Assert.AreEqual (Color.Red, item.SubItems [2].BackColor, "#D4");
1481 Assert.AreSame (font, item.SubItems [2].Font, "#D5");
1482 Assert.IsNotNull (item.SubItems [3], "#E1");
1483 Assert.AreSame (subItemCText, item.SubItems [3].Text, "#E2");
1484 Assert.AreEqual (Color.Blue, item.SubItems [3].ForeColor, "#E3");
1485 Assert.AreEqual (Color.Red, item.SubItems [3].BackColor, "#E4");
1486 Assert.AreSame (font, item.SubItems [3].Font, "#E6");
1490 public void AddRange3_Items_Null ()
1492 ListViewItem item = new ListViewItem ();
1494 item.SubItems.AddRange ((string []) null, Color.Blue, Color.Red,
1495 new Font ("Arial", 14));
1497 } catch (ArgumentNullException ex) {
1498 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
1499 Assert.IsNotNull (ex.Message, "#3");
1500 Assert.IsNotNull (ex.ParamName, "#4");
1501 Assert.AreEqual ("items", ex.ParamName, "#5");
1502 Assert.IsNull (ex.InnerException, "#6");
1507 public void AddRange4 ()
1509 ListViewItem item = new ListViewItem ();
1510 Assert.AreEqual (1, item.SubItems.Count, "#1");
1512 item.SubItems.AddRange (new string [3]);
1513 Assert.AreEqual (1, item.SubItems.Count, "#2");
1515 item.SubItems.AddRange (new ListViewItem.ListViewSubItem [3]);
1516 Assert.AreEqual (1, item.SubItems.Count, "#3");
1520 public void Clear ()
1522 ListViewItem item = new ListViewItem ();
1523 item.SubItems.AddRange (new string [] { "A", "B", "C" });
1524 item.SubItems.Clear ();
1525 Assert.AreEqual (1, item.SubItems.Count, "#1");
1526 Assert.IsNotNull (item.SubItems [0].Text, "#2");
1527 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#3");
1531 public void RemoveAt ()
1533 ListViewItem item = new ListViewItem ();
1534 item.SubItems.AddRange (new string [] { "A", "B" });
1535 Assert.AreEqual (3, item.SubItems.Count, "#A1");
1536 Assert.IsNotNull (item.SubItems [0].Text, "#A2");
1537 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#A3");
1538 Assert.IsNotNull (item.SubItems [1].Text, "#A4");
1539 Assert.AreEqual ("A", item.SubItems [1].Text, "#A5");
1540 Assert.IsNotNull (item.SubItems [2].Text, "#A6");
1541 Assert.AreEqual ("B", item.SubItems [2].Text, "#A7");
1543 item.SubItems.RemoveAt (1);
1545 Assert.AreEqual (2, item.SubItems.Count, "#B1");
1546 Assert.IsNotNull (item.SubItems [0].Text, "#B2");
1547 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#B3");
1548 Assert.IsNotNull (item.SubItems [1].Text, "#B4");
1549 Assert.AreEqual ("B", item.SubItems [1].Text, "#B5");
1551 item.SubItems.RemoveAt (0);
1553 Assert.AreEqual (1, item.SubItems.Count, "#C1");
1554 Assert.IsNotNull (item.SubItems [0].Text, "#C2");
1555 Assert.AreEqual ("B", item.SubItems [0].Text, "#C3");
1557 item.SubItems.RemoveAt (0);
1559 Assert.AreEqual (1, item.SubItems.Count, "#D1");
1560 Assert.IsNotNull (item.SubItems [0].Text, "#D2");
1561 Assert.AreEqual (string.Empty, item.SubItems [0].Text, "#D3");