예제 #1
0
        public void chooseColorTest()
        {
            BMPLogic logic = new BMPLogic(200, 200);

            logic.chooseColor(new DataGridViewCellMouseEventArgs(0, 0, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 250, 250, -1)));
            Assert.Equal(Color.Black, logic.getPen().Color);
            logic.chooseColor(new DataGridViewCellMouseEventArgs(1, 0, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 250, 250, -1)));
            Assert.Equal(Color.Blue, logic.getPen().Color);
            logic.chooseColor(new DataGridViewCellMouseEventArgs(2, 0, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 250, 250, -1)));
            Assert.Equal(Color.Green, logic.getPen().Color);
            logic.chooseColor(new DataGridViewCellMouseEventArgs(3, 0, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 250, 250, -1)));
            Assert.Equal(Color.Aqua, logic.getPen().Color);
            logic.chooseColor(new DataGridViewCellMouseEventArgs(0, 1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 250, 250, -1)));
            Assert.Equal(Color.Red, logic.getPen().Color);
            logic.chooseColor(new DataGridViewCellMouseEventArgs(1, 1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 250, 250, -1)));
            Assert.Equal(Color.Magenta, logic.getPen().Color);
            logic.chooseColor(new DataGridViewCellMouseEventArgs(2, 1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 250, 250, -1)));
            Assert.Equal(Color.White, logic.getPen().Color);
            logic.chooseColor(new DataGridViewCellMouseEventArgs(3, 1, 0, 0, new MouseEventArgs(MouseButtons.Left, 0, 250, 250, -1)));
            Assert.Equal(Color.Yellow, logic.getPen().Color);
        }
예제 #2
0
 /// <summary>
 /// Обработка выбора цвета
 /// </summary>
 /// <param name="sender">Отправитель</param>
 /// <param name="e">Параметры</param>
 private void colors_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
 {
     logic.chooseColor(e);
 }