131 instantiations of Icon
DesignSurface (1)
System.Drawing.Common.Tests (65)
System\Drawing\IconTests.cs (52)
40using Icon icon = new(Helpers.GetTestBitmapPath(name));
70using Icon icon = new(Helpers.GetTestBitmapPath(fileName), size.Width, size.Height);
80using Icon icon = new(Helpers.GetTestBitmapPath(fileName), size);
89AssertExtensions.Throws<ArgumentNullException>("path", () => new Icon((string)null));
90AssertExtensions.Throws<ArgumentNullException>("path", () => new Icon((string)null, new Size(32, 32)));
91AssertExtensions.Throws<ArgumentNullException>("path", () => new Icon((string)null, 32, 32));
98Icon icon = new(stream);
108Icon icon = new(stream);
125using Icon icon = new(stream, size.Width, size.Height);
136using Icon icon = new(stream, size);
145AssertExtensions.Throws<ArgumentNullException, ArgumentException>("stream", null, () => new Icon((Stream)null));
146AssertExtensions.Throws<ArgumentNullException, ArgumentException>("stream", null, () => new Icon((Stream)null, 32, 32));
147AssertExtensions.Throws<ArgumentNullException, ArgumentException>("stream", null, () => new Icon((Stream)null, new Size(32, 32)));
215Assert.Throws(exceptionType, () => new Icon(stream));
222using Icon sourceIcon = new(Helpers.GetTestBitmapPath(fileName));
223using Icon icon = new(sourceIcon, size.Width, size.Height);
234using Icon sourceIcon = new(Helpers.GetTestBitmapPath(fileName));
235using Icon icon = new(sourceIcon, size);
245AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new Icon((Icon)null, 32, 32));
246AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new Icon((Icon)null, new Size(32, 32)));
252using Icon icon = new(typeof(IconTests), "48x48_multiple_entries_4bit.ico");
260Assert.Throws<NullReferenceException>(() => new Icon(null, "48x48_multiple_entries_4bit.ico"));
269AssertExtensions.Throws<ArgumentException>(null, () => new Icon(type, resource));
275AssertExtensions.Throws<ArgumentNullException, ArgumentException>("resource", null, () => new Icon(typeof(Icon), null));
281using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
305Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
322using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
337using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_32bit.ico"), size, size);
425SaveAndCompare(new Icon(Helpers.GetTestBitmapPath(fileName)), true);
432using Icon icon = new(filePath);
442Icon icon = new(filePath);
452using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
459using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
469using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
479using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
507yield return new object[] { new Icon(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")) };
508yield return new object[] { new Icon(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico")) };
509yield return new object[] { new Icon(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico")) };
510yield return new object[] { new Icon(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico")) };
511yield return new object[] { new Icon(Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico")) };
512yield return new object[] { new Icon(Helpers.GetTestBitmapPath("256x256_two_entries_multiple_bits.ico"), 48, 48) };
513yield return new object[] { new Icon(Helpers.GetTestBitmapPath("256x256_two_entries_multiple_bits.ico"), 256, 256) };
514yield return new object[] { new Icon(Helpers.GetTestBitmapPath("256x256_two_entries_multiple_bits.ico"), 0, 0) };
544using Icon originalIcon = new(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico"));
630return new Icon(stream);
636using Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
646using Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
664using (Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
679using (Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
706Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
720using Icon loaded = new(outputStream);
751using Icon icon = new(stream, new Size(32, 32));
System.Windows.Forms (10)
System.Windows.Forms.Design (21)
System.Windows.Forms.Design.Tests (4)
System.Windows.Forms.Primitives (1)
System.Windows.Forms.Tests (29)
293 references to Icon
Accessibility_Core_App (1)
DesignSurface (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
PresentationUI (13)
System.Drawing (1)
System.Drawing.Common (17)
System.Drawing.Common.Tests (113)
System\Drawing\IconTests.cs (92)
40using Icon icon = new(Helpers.GetTestBitmapPath(name));
70using Icon icon = new(Helpers.GetTestBitmapPath(fileName), size.Width, size.Height);
80using Icon icon = new(Helpers.GetTestBitmapPath(fileName), size);
98Icon icon = new(stream);
108Icon icon = new(stream);
125using Icon icon = new(stream, size.Width, size.Height);
136using Icon icon = new(stream, size);
222using Icon sourceIcon = new(Helpers.GetTestBitmapPath(fileName));
223using Icon icon = new(sourceIcon, size.Width, size.Height);
234using Icon sourceIcon = new(Helpers.GetTestBitmapPath(fileName));
235using Icon icon = new(sourceIcon, size);
245AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new Icon((Icon)null, 32, 32));
246AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new Icon((Icon)null, new Size(32, 32)));
252using Icon icon = new(typeof(IconTests), "48x48_multiple_entries_4bit.ico");
264[InlineData(typeof(Icon), "")]
265[InlineData(typeof(Icon), "48x48_multiple_entries_4bit.ico")]
275AssertExtensions.Throws<ArgumentNullException, ArgumentException>("resource", null, () => new Icon(typeof(Icon), null));
281using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
282using Icon clone = Assert.IsType<Icon>(icon.Clone());
293using var icon = Icon.FromHandle(SystemIcons.Hand.Handle);
294using Icon clone = Assert.IsType<Icon>(icon.Clone());
305Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
313Icon icon = Icon.ExtractAssociatedIcon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
322using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
323using var icon = Icon.FromHandle(source.Handle);
337using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_32bit.ico"), size, size);
379using Icon icon = Icon.ExtractAssociatedIcon(filePath);
390Assert.Null(Icon.ExtractAssociatedIcon("http://microsoft.com"));
394Assert.Throws<FileNotFoundException>(() => Icon.ExtractAssociatedIcon("http://microsoft.com"));
401AssertExtensions.Throws<ArgumentNullException, ArgumentException>("filePath", null, () => Icon.ExtractAssociatedIcon(null));
407AssertExtensions.Throws<ArgumentException>("filePath", null, () => Icon.ExtractAssociatedIcon(""));
413Assert.Throws<FileNotFoundException>(() => Icon.ExtractAssociatedIcon("no-such-file.png"));
432using Icon icon = new(filePath);
442Icon icon = new(filePath);
452using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
459using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
460var icon = Icon.FromHandle(source.Handle);
469using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
479using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
480using var icon = Icon.FromHandle(source.Handle);
499Icon icon = Icon.ExtractAssociatedIcon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
519public void ToBitmap_BitmapIcon_ReturnsExpected(Icon icon)
544using Icon originalIcon = new(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico"));
545using Icon icon = Icon.FromHandle(originalIcon.Handle);
556using Icon icon = GetPngIcon();
591using Icon icon = GetPngIcon();
610private static Icon GetPngIcon()
636using Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
637using Icon icon2 = Icon.FromHandle(icon1.Handle);
646using Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
647using (Icon icon2 = Icon.FromHandle(icon1.Handle))
654using Icon icon3 = Icon.FromHandle(icon1.Handle);
664using (Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
669using Icon icon2 = Icon.FromHandle(handle);
679using (Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
684using (Icon icon2 = Icon.FromHandle(handle))
691using Icon icon3 = Icon.FromHandle(handle);
700AssertExtensions.Throws<ArgumentException>("handle", null, () => Icon.FromHandle(IntPtr.Zero));
706Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
714private static void SaveAndCompare(Icon icon, bool alpha)
720using Icon loaded = new(outputStream);
751using Icon icon = new(stream, new Size(32, 32));
758FieldInfo fi = typeof(Icon).GetField(fieldName, BindingFlags.Static | BindingFlags.NonPublic);
786Assert.Throws<ArgumentNullException>(() => { Icon.ExtractIcon(null!, 0, 16); });
787Assert.Throws<ArgumentNullException>(() => { Icon.ExtractIcon(null!, 0); });
793Assert.Throws<IOException>(() => { Icon.ExtractIcon(string.Empty, 0, 16); });
794Assert.Throws<IOException>(() => { Icon.ExtractIcon(string.Empty, 0); });
804Assert.Throws<ArgumentOutOfRangeException>(() => { Icon.ExtractIcon("Foo", 0, size); });
812Icon.ExtractIcon(Path.GetRandomFileName() + ".ico", 0, 16);
817Icon.ExtractIcon(Path.GetRandomFileName() + ".ico", 0);
825Assert.Null(Icon.ExtractIcon(file.Path, 0, 16));
826Assert.Null(Icon.ExtractIcon(file.Path, 0));
832Icon? icon;
834while ((icon = Icon.ExtractIcon("regedit.exe", count, 16)) is not null)
850using Icon? icon = Icon.ExtractIcon("regedit.exe", -100, 256);
System.Windows.Forms (64)
System.Windows.Forms.Design (4)
System.Windows.Forms.Design.Tests (11)
System.Windows.Forms.Primitives (2)
System.Windows.Forms.Primitives.Tests (5)
System.Windows.Forms.Tests (57)
WinFormsControlsTest (1)