Beispiel #1
0
        public void Test_SpeedSummaryPalette_ChooseColour()
        {
            var palette = new SpeedSummaryPalette();

            palette.Should().NotBeNull();

            var data = new MachineSpeedExtendedRecord(MEASURED_SPEED_MIN, MEASURED_SPEED_MAX);

            var colors = new[] {
                palette.LowerSpeedRangeColour,
                palette.WithinSpeedRangeColour,
                palette.WithinSpeedRangeColour,
                palette.WithinSpeedRangeColour,
                palette.WithinSpeedRangeColour,
                palette.OverSpeedRangeColour,
                palette.OverSpeedRangeColour,
            };

            for (var i = 0; i < colors.Length; i++)
            {
                data.Min = (ushort)(MEASURED_SPEED_MIN + i * SPEED_INCREMENT);
                data.Max = (ushort)(MEASURED_SPEED_MAX + i * SPEED_INCREMENT);

                palette.ChooseColour(data).Should().Be(colors[i]);
            }
        }
Beispiel #2
0
        public void Test_NullCells()
        {
            var cell = new MachineSpeedExtendedRecord();

            cell.Clear();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.MachineSpeedTarget) as ClientMachineTargetSpeedLeafSubGrid;

            SubGridUtilities.SubGridDimensionalIterator((x, y) => Assert.True(clientGrid.Cells[x, y].Equals(cell)));
        }
Beispiel #3
0
        public void Test_SpeedSummaryPalette_ChooseColour_NullTargetRange()
        {
            var palette = new SpeedSummaryPalette();

            palette.Should().NotBeNull();

            palette.MachineSpeedTarget = new MachineSpeedExtendedRecord(CellPassConsts.NullMachineSpeed, CellPassConsts.NullMachineSpeed);

            var data = new MachineSpeedExtendedRecord(MEASURED_SPEED_MIN, MEASURED_SPEED_MAX);

            var colors = new[] { Color.Empty, Color.Empty, Color.Empty, Color.Empty, Color.Empty, Color.Empty, Color.Empty };

            for (var i = 0; i < colors.Length; i++)
            {
                data.Min = (ushort)(MEASURED_SPEED_MIN + i * SPEED_INCREMENT);
                data.Max = (ushort)(MEASURED_SPEED_MAX + i * SPEED_INCREMENT);

                palette.ChooseColour(data).Should().Be(colors[i]);
            }
        }
Beispiel #4
0
        public Color ChooseColour(MachineSpeedExtendedRecord measuredSpeed)
        {
            var color = Color.Empty;

            if (MachineSpeedTarget.Max != CellPassConsts.NullMachineSpeed)
            {
                if (measuredSpeed.Max > MachineSpeedTarget.Max)
                {
                    color = OverSpeedRangeColour;
                }
                else
                {
                    color = measuredSpeed.Min < MachineSpeedTarget.Min && measuredSpeed.Max < MachineSpeedTarget.Min
            ? LowerSpeedRangeColour
            : WithinSpeedRangeColour;
                }
            }

            return(color);
        }