Ejemplo n.º 1
0
        public void RelianceEffectsTest()
        {
            var printer = new ReliancePrinter(TEST_PORT);

            Assert.IsNotNull(printer);

            Assert.AreEqual(FontEffects.None, printer.Effects);

            // Set some effects
            printer.AddEffect(FontEffects.Bold);
            Assert.AreEqual(FontEffects.Bold, printer.Effects);

            printer.AddEffect(FontEffects.Italic);
            Assert.AreEqual(FontEffects.Bold | FontEffects.Italic, printer.Effects);

            printer.AddEffect(FontEffects.Underline);
            Assert.AreEqual(FontEffects.Bold | FontEffects.Italic | FontEffects.Underline, printer.Effects);

            printer.AddEffect(FontEffects.Rotated);
            Assert.AreEqual(FontEffects.Bold | FontEffects.Italic | FontEffects.Underline | FontEffects.Rotated,
                            printer.Effects);

            printer.AddEffect(FontEffects.Reversed);
            Assert.AreEqual(FontEffects.Bold | FontEffects.Italic | FontEffects.Underline | FontEffects.Rotated | FontEffects.Reversed,
                            printer.Effects);

            // Clear them out
            printer.ClearAllEffects();
            Assert.AreEqual(FontEffects.None, printer.Effects);

            // Set some effects
            printer.AddEffect(FontEffects.Bold | FontEffects.Italic | FontEffects.Underline | FontEffects.Rotated | FontEffects.Reversed);
            Assert.AreEqual(FontEffects.Bold | FontEffects.Italic | FontEffects.Underline | FontEffects.Rotated | FontEffects.Reversed, printer.Effects);

            printer.RemoveEffect(FontEffects.Bold);
            Assert.AreEqual(FontEffects.Italic | FontEffects.Underline | FontEffects.Rotated | FontEffects.Reversed, printer.Effects);

            printer.RemoveEffect(FontEffects.Italic);
            Assert.AreEqual(FontEffects.Underline | FontEffects.Rotated | FontEffects.Reversed, printer.Effects);

            printer.RemoveEffect(FontEffects.Underline);
            Assert.AreEqual(FontEffects.Rotated | FontEffects.Reversed,
                            printer.Effects);

            printer.RemoveEffect(FontEffects.Rotated);
            Assert.AreEqual(FontEffects.Reversed, printer.Effects);

            printer.RemoveEffect(FontEffects.Reversed);
            Assert.AreEqual(FontEffects.None, printer.Effects);
        }
        public void REL_RealHardwareTests()
        {
            var printer = new ReliancePrinter(TEST_PORT);

            Assert.IsNotNull(printer);

            printer.Reinitialize();

            printer.PrintASCIIString("No effects - Left");
            printer.PrintNewline();

            printer.AddEffect(FontEffects.Bold);
            printer.PrintASCIIString("This is bold");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Bold);
            printer.AddEffect(FontEffects.Italic);
            printer.PrintASCIIString("This is italic");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Italic);
            printer.AddEffect(FontEffects.Underline);
            printer.PrintASCIIString("This is underline");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Underline);
            printer.AddEffect(FontEffects.Rotated);
            printer.PrintASCIIString("This is rotated");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Rotated);
            printer.AddEffect(FontEffects.Reversed);
            printer.PrintASCIIString("This is reversed");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Reversed);
            printer.AddEffect(FontEffects.UpsideDown);
            printer.PrintASCIIString("This is upsideDown");
            printer.PrintNewline();

            printer.Reinitialize();
            printer.SetJustification(FontJustification.JustifyCenter);
            printer.PrintASCIIString("No effects - Center");
            printer.PrintNewline();

            printer.AddEffect(FontEffects.Bold);
            printer.PrintASCIIString("This is bold");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Bold);
            printer.AddEffect(FontEffects.Italic);
            printer.PrintASCIIString("This is italic");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Italic);
            printer.AddEffect(FontEffects.Underline);
            printer.PrintASCIIString("This is underline");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Underline);
            printer.AddEffect(FontEffects.Rotated);
            printer.PrintASCIIString("This is rotated");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Rotated);
            printer.AddEffect(FontEffects.Reversed);
            printer.PrintASCIIString("This is reversed");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Reversed);
            printer.AddEffect(FontEffects.UpsideDown);
            printer.PrintASCIIString("This is upsideDown");
            printer.PrintNewline();

            printer.Reinitialize();
            printer.SetJustification(FontJustification.JustifyRight);
            printer.PrintASCIIString("No effects - Right");
            printer.PrintNewline();

            printer.AddEffect(FontEffects.Bold);
            printer.PrintASCIIString("This is bold");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Bold);
            printer.AddEffect(FontEffects.Italic);
            printer.PrintASCIIString("This is italic");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Italic);
            printer.AddEffect(FontEffects.Underline);
            printer.PrintASCIIString("This is underline");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Underline);
            printer.AddEffect(FontEffects.Rotated);
            printer.PrintASCIIString("This is rotated");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Rotated);
            printer.AddEffect(FontEffects.Reversed);
            printer.PrintASCIIString("This is reversed");
            printer.PrintNewline();

            printer.RemoveEffect(FontEffects.Reversed);
            printer.AddEffect(FontEffects.UpsideDown);
            printer.PrintASCIIString("This is upsideDown");
            printer.PrintNewline();

            printer.Reinitialize();
            printer.PrintASCIIString("Scalars");
            printer.PrintNewline();

            printer.PrintASCIIString("WH1x");
            printer.SetScalars(FontWidthScalar.w2, FontHeighScalar.h2);
            printer.PrintASCIIString("WH2x");
            printer.SetScalars(FontWidthScalar.w3, FontHeighScalar.h3);
            printer.PrintASCIIString("WH3x");
            printer.SetScalars(FontWidthScalar.w4, FontHeighScalar.h4);
            printer.PrintASCIIString("WH4x");
            printer.SetScalars(FontWidthScalar.w5, FontHeighScalar.h5);
            printer.PrintASCIIString("WH5x");
            printer.SetScalars(FontWidthScalar.w6, FontHeighScalar.h6);
            printer.PrintASCIIString("WH6x");
            printer.SetScalars(FontWidthScalar.w7, FontHeighScalar.h7);
            printer.PrintASCIIString("WH7x");
            printer.SetScalars(FontWidthScalar.w8, FontHeighScalar.h8);
            printer.PrintASCIIString("WH8x");
            printer.PrintNewline();

            printer.PrintASCIIString("H1x");
            printer.SetScalars(FontWidthScalar.w1, FontHeighScalar.h2);
            printer.PrintASCIIString("H2x");
            printer.SetScalars(FontWidthScalar.w1, FontHeighScalar.h3);
            printer.PrintASCIIString("H3x");
            printer.SetScalars(FontWidthScalar.w1, FontHeighScalar.h4);
            printer.PrintASCIIString("H4x");
            printer.SetScalars(FontWidthScalar.w1, FontHeighScalar.h5);
            printer.PrintASCIIString("H5x");
            printer.SetScalars(FontWidthScalar.w1, FontHeighScalar.h6);
            printer.PrintASCIIString("H6x");
            printer.SetScalars(FontWidthScalar.w1, FontHeighScalar.h7);
            printer.PrintASCIIString("H7x");
            printer.SetScalars(FontWidthScalar.w1, FontHeighScalar.h8);
            printer.PrintASCIIString("H8x");
            printer.PrintNewline();

            printer.PrintASCIIString("W1x");
            printer.SetScalars(FontWidthScalar.w2, FontHeighScalar.h1);
            printer.PrintASCIIString("W2x");
            printer.SetScalars(FontWidthScalar.w3, FontHeighScalar.h1);
            printer.PrintASCIIString("W3x");
            printer.SetScalars(FontWidthScalar.w4, FontHeighScalar.h1);
            printer.PrintASCIIString("W4x");
            printer.SetScalars(FontWidthScalar.w5, FontHeighScalar.h1);
            printer.PrintASCIIString("W5x");
            printer.SetScalars(FontWidthScalar.w6, FontHeighScalar.h1);
            printer.PrintASCIIString("W6x");
            printer.SetScalars(FontWidthScalar.w7, FontHeighScalar.h1);
            printer.PrintASCIIString("W7x");
            printer.SetScalars(FontWidthScalar.w8, FontHeighScalar.h1);
            printer.PrintASCIIString("W8x");
            printer.PrintNewline();


            printer.PrintNewline();
            printer.FormFeed();
        }