/// <summary>
        ///     Tests the message bitmap.
        /// </summary>
        /// <externalUnit/>
        /// <revision revisor="dev13" date="11/19/2009" version="1.1.3.7">
        ///     Added documentation header
        /// </revision>
        private static void TestMessageBitmap()
        {
            Bitmap bitmap = MessageBitmap.Draw(1234567890, 0.125F, 96);

            bitmap.RotateFlip(RotateFlipType.Rotate90FlipY);
            bitmap.Save("Invalid 1234567890.bmp", ImageFormat.Bmp);
        }
Exemplo n.º 2
0
        public void TestDraw()
        {
            // test all digits
            Bitmap bitmap = MessageBitmap.Draw(1234567890, 0.125F, 96);

            bitmap.Save("Invalid 1234567890.bmp", ImageFormat.Bmp);
            Assert.IsTrue(true);

            // test negative numbers
            bitmap = MessageBitmap.Draw(-1, 0.125F, 96);
            bitmap.Save("Invalid -1.bmp", ImageFormat.Bmp);
            Assert.IsTrue(true);

            // test special characters
            try
            {
                bitmap = MessageBitmap.Draw(@"ית", 0.125F, 96, 10, 10);
                bitmap.Save("Invalid special chars.bmp", ImageFormat.Bmp);

                // an exception has to be thrown, otherwise, the test failed
                // therefore a true assertion on false
                Assert.IsTrue(false);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex is CharacterNotSupportedException);
            }

            // test margins
            bitmap = MessageBitmap.Draw("123", 0.125F, 96, 7, 5);
            bitmap.Save("Invalid margins.bmp", ImageFormat.Bmp);
            Assert.IsTrue(true);
        }