Esempio n. 1
0
        public void AllResourceCharactersCanBeResolvedBySpriteFont()
        {
            var SupportedLanguages = new[] { "en-US", "de-DE", "es-ES", "pl" };

            foreach (var Language in SupportedLanguages)
            {
                var GameSettings = new GameSettings()
                {
                    Culture = Language
                };

                using (var GraphicsDevice = Mock.CreateGraphicsDevice())
                    using (var Runner = new SessionSevenTestEngine(new TestGame(), Mock.Wrap(GraphicsDevice), Mock.Input, GameSettings))
                    {
                        Runner.StartGame();
                        Runner.AdvanceToInteractive();

                        var Text        = Runner.Game.World.GetScene(TestGame.SCENE_ID).GetObject(TestGame.ENTITY_OUTLINE_ID).Get <Text>();
                        var OutlineText = Runner.Game.World.GetScene(TestGame.SCENE_ID).GetObject(TestGame.ENTITY_OUTLINE_ID).Get <Text>();

                        foreach (var ResourceString in GetResourceStrings())
                        {
                            // this throws if the sprite font cannot resolve a character
                            Text.Set(ResourceString, TextDuration.Persistent, Vector2.Zero);
                            OutlineText.Set(ResourceString, TextDuration.Persistent, Vector2.Zero);
                        }
                    }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new SessionSevenTestEngine and executes an action with it.
        /// </summary>
        /// <param name="action"></param>
        public static void Execute(Action <SessionSevenTestEngine> action)
        {
            using (var GraphicsDevice = Mock.CreateGraphicsDevice())
                using (var Runner = new SessionSevenTestEngine(new Game(), Mock.Wrap(GraphicsDevice), Mock.Input))
                {
                    Runner.StartGame();
                    Runner.AdvanceToInteractive();

                    action(Runner);
                }
        }