コード例 #1
0
        public void GetIconForUnknownReturnsDifferentIconForDifferentColors()
        {
            using DynamicIcons icons = new DynamicIcons();
            Icon icon1 = icons.GetIconForUnknown(FG, BG);
            Icon icon2 = icons.GetIconForUnknown(Color.Black, Color.White);

            Assert.AreNotSame(icon1, icon2);
        }
コード例 #2
0
        public void GetIconForNumberReturnsSameIconForSameInput()
        {
            using DynamicIcons icons = new DynamicIcons();
            Icon icon1 = icons.GetIconForNumber(42, FG, BG);
            Icon icon2 = icons.GetIconForNumber(42, FG, BG);

            Assert.AreSame(icon1, icon2);
        }
コード例 #3
0
        public void GetIconForUnknownReturnsSameIconForSameColors()
        {
            using DynamicIcons icons = new DynamicIcons();
            Icon icon1 = icons.GetIconForUnknown(FG, BG);
            Icon icon2 = icons.GetIconForUnknown(FG, BG);

            Assert.AreSame(icon1, icon2);
        }
コード例 #4
0
        public void GetIconForNumberReturnsDifferentIconsForDifferentColors()
        {
            using DynamicIcons icons = new DynamicIcons();
            Icon icon1 = icons.GetIconForNumber(42, FG, BG);
            Icon icon2 = icons.GetIconForNumber(42, Color.Blue, Color.Purple);

            Assert.AreNotSame(icon1, icon2);
        }
コード例 #5
0
        public void GetIconForNumberReturnsIconShowingThreeDigits()
        {
            using DynamicIcons icons = new DynamicIcons();
            Icon icon = icons.GetIconForNumber(188, FG, BG);

            Assert.AreEqual(16, icon.Width);
            Assert.AreEqual(16, icon.Height);
            AssertIconHasPixels(new ushort[16]
            {
                0x0000, 0x79E4, 0x4924, 0x4924, 0x4924, 0x4924, 0x4924, 0x79E4,
                0x4924, 0x4924, 0x4924, 0x4924, 0x4924, 0x79E4, 0x0000, 0x0000
            },
                                icon);
        }
コード例 #6
0
        public void ResetClearsInternalCacheOfPreviouslyRenderedIcons()
        {
            using DynamicIcons icons = new DynamicIcons();
            Icon unknownIcon1 = icons.GetIconForUnknown(FG, BG);
            Icon numberIcon1  = icons.GetIconForNumber(42, FG, BG);

            icons.Reset();

            Icon unknownIcon2 = icons.GetIconForUnknown(FG, BG);
            Icon numberIcon2  = icons.GetIconForNumber(42, FG, BG);

            Assert.AreNotSame(unknownIcon1, unknownIcon2);
            Assert.AreNotSame(numberIcon1, numberIcon2);
        }
コード例 #7
0
        public void GetIconForUnknownReturnsIconShowingSingleX()
        {
            using DynamicIcons icons = new DynamicIcons();
            Icon icon = icons.GetIconForUnknown(FG, BG);

            Assert.AreEqual(16, icon.Width);
            Assert.AreEqual(16, icon.Height);
            AssertIconHasPixels(new ushort[16]
            {
                0x0000, 0x0420, 0x0420, 0x0240, 0x0240, 0x0180, 0x0180, 0x0180,
                0x0180, 0x0180, 0x0240, 0x0240, 0x0420, 0x0420, 0x0000, 0x0000
            },
                                icon);
        }