예제 #1
0
        public void TestChangeParticleType()
        {
            var pm = new FakeMAOParticleManager(new Rectangle(0, 0, 800, 400), 100000, 1);

            FSGGame.controller = new FakeController();
            var c = FSGGame.controller as FakeController;
            c.selectup = true;
            GameTime gt = new GameTime(new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0, 0, 100)); // one millisecond

            var screen = new ParticleTestScreen(new ScreenContainer());
            screen.pm = pm;
            screen.Update(gt);

            //at least one particle was added (can be more from brush)
            Assert.Greater(screen.brushSize, 3);
            c.selectup = false;
            c.selectdown = true;
            screen.Update(gt);
            Assert.AreEqual(screen.brushSize, 3);
        }
예제 #2
0
        public void TestHoldPlaceParticle()
        {
            var pm = new FakeMAOParticleManager(new Rectangle(0, 0, 800, 400), 100000, 1);
            int lastCount = 0;
            int lastAdd = 0;

            FSGGame.controller = new FakeController();
            var c = FSGGame.controller as FakeController;
            c.mousex = 50;
            c.mousey = 50;
            c.a = true;
            GameTime gt = new GameTime(new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0, 0, 100)); // one millisecond

            var screen = new ParticleTestScreen(new ScreenContainer());
            screen.pm = pm;
            for (int i = 0; i < 5; i++)
            {
                //create some movement to avoid clogging the screen
                c.mousex = 50 + 5*i;
                c.mousey = 50 + i;
                lastAdd = pm.numberParticlesToAdd();
                lastCount = pm.numberParticles();
                screen.Update(gt);
                Assert.Greater(pm.numberParticlesToAdd(), 0);
                /*
                 * total particles should be less than or equal the amount contained + added in the
                 * last step. (there may be overlap in random placement or particles drifting
                 * offscreen to decrease below this number)
                 */
                Assert.LessOrEqual( pm.numberParticles(),lastAdd+lastCount);

            }
        }
예제 #3
0
        public void TestPlaceParticle()
        {
            var pm = new FakeMAOParticleManager(new Rectangle(0, 0, 800, 400), 100000, 1);

            FSGGame.controller = new FakeController();
            var c = FSGGame.controller as FakeController;
            c.mousex = 50;
            c.mousey = 50;
            c.a = true;
            GameTime gt = new GameTime(new TimeSpan(0, 0, 0), new TimeSpan(0,0,0,0,100)); // one millisecond

            var screen = new ParticleTestScreen(new ScreenContainer());
            screen.pm = pm;
            screen.Update(gt);  //update to put particles on add list
            Assert.Greater(pm.numberParticlesToAdd(), 0);
            c.a = false;
            screen.Update(gt);  //update to put particles in data structure
            //at least one particle was added (can be more from brush)
            Assert.Greater(pm.numberParticles(), 0);
            Assert.AreEqual(0, pm.numberParticlesToAdd());
        }
예제 #4
0
        public void TestPlaceParticleOutsideY()
        {
            var pm = new FakeMAOParticleManager(new Rectangle(0, 0, 800, 400), 100000, 1);

            FSGGame.controller = new FakeController();
            var c = FSGGame.controller as FakeController;
            c.mousex = 750;
            c.mousey = 450;
            c.a = true;
            GameTime gt = new GameTime(new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0, 0, 1)); // one millisecond

            var screen = new ParticleTestScreen(new ScreenContainer());
            screen.pm = pm;
            screen.Update(gt);  //update to put particles on add list
            screen.Update(gt);  //update to put particles in data structure

            //no particles should be placed
            Assert.AreEqual(0,pm.numberParticles());
        }
예제 #5
0
        public void TestParticleSizeChange()
        {
            var pm = new FakeMAOParticleManager(new Rectangle(0, 0, 800, 400), 100000, 1);

            FSGGame.controller = new FakeController();
            var c = FSGGame.controller as FakeController;
            c.selectleft = true;
            GameTime gt = new GameTime(new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0, 0, 100)); // one millisecond

            var screen = new ParticleTestScreen(new ScreenContainer());
            screen.pm = pm;
            screen.Update(gt);

            //successfully changed to wall
            Assert.AreEqual(screen.currentParticle, Particle_Type.Wall);

            screen.Update(gt);
            //changed back to sand since left is down again
            Assert.AreEqual(screen.currentParticle, Particle_Type.Sand);
        }