Exemple #1
0
        public void CharacterMapsAreConsistent()
        {
            // The constructor (or even the initializer) throws if the map is inconsistent (like the dictionary contains duplicate keys)
            LcdCharacterEncodingFactory factory = new LcdCharacterEncodingFactory();
            var encoding = factory.Create(new CultureInfo("de-CH"), "A00", '?', 8);

            byte[] bytes = encoding.GetBytes("ABÖ");
            Assert.Equal((byte)'A', bytes[0]);
            Assert.Equal((byte)'B', bytes[1]);
            Assert.Equal(3, bytes[2]);
            Assert.NotNull(encoding.ExtraCharacters[3]);
        }
Exemple #2
0
        public CharacterDisplay(ArduinoBoard board)
        {
            _controller = board.CreateGpioController();
            _display    = new Lcd1602(8, 9, new int[] { 4, 5, 6, 7 }, -1, 1.0f, -1, _controller);
            _display.BlinkingCursorVisible  = false;
            _display.UnderlineCursorVisible = false;
            _display.Clear();

            _textController = new LcdConsole(_display, "SplC780", false);
            _textController.Clear();
            LcdCharacterEncodingFactory f = new LcdCharacterEncodingFactory();
            var cultureEncoding           = f.Create(CultureInfo.CurrentCulture, "SplC780", '?', _display.NumberOfCustomCharactersSupported);

            _textController.LoadEncoding(cultureEncoding);
        }
Exemple #3
0
        public void JapaneseDoesNotWorkWithOtherSets()
        {
            LcdCharacterEncodingFactory factory = new LcdCharacterEncodingFactory();

            Assert.Throws <NotSupportedException>(() => factory.Create(new CultureInfo("ja-JP"), "A02", '?', 8));
        }