Beispiel #1
0
        public void GetTileMean()
        {
            var         timestamp  = TimeSpan.FromSeconds(6);
            IScreenshot screenshot = new EmguScreenshot("Screenshots/tetris_play_2.png", timestamp);

            for (int i = 0; i < 5; i++)
            {
                // test multiple time
                Assert.AreEqual(31, screenshot.GetTileMean(0, 0));
            }

            Assert.AreEqual(103, screenshot.GetTileMean(1, 0));
            Assert.AreEqual(255, screenshot.GetTileMean(2, 0));

            Assert.AreEqual(85, screenshot.GetTileMean(5, 7));

            Assert.AreEqual(255, screenshot.GetTileMean(5, 6));
        }
Beispiel #2
0
        public void GetTileMeanException()
        {
            var         timestamp  = TimeSpan.FromSeconds(6);
            IScreenshot screenshot = new EmguScreenshot("Screenshots/tetris_play_2.png", timestamp);

            screenshot.GetTileMean(0, 0);
            screenshot.GetTileMean(19, 17);

            Assert.Throws <ArgumentException>(() =>
            {
                screenshot.GetTileMean(-1, 0);
            });
            Assert.Throws <ArgumentException>(() =>
            {
                screenshot.GetTileMean(0, -1);
            });
            Assert.Throws <ArgumentException>(() =>
            {
                screenshot.GetTileMean(20, 0);
            });
            Assert.Throws <ArgumentException>(() =>
            {
                screenshot.GetTileMean(0, 18);
            });
        }