public void CursorPosition_sets_the_cursor_position() { var infoBar = new InfoBar(_spriteBatch, _spriteFont); var expectedPosition = new Vector2(59, 100); infoBar.CursorPosition = expectedPosition; Assert.AreEqual(expectedPosition, infoBar.CursorPosition); }
public void DrawString_calls_DrawString_on_SpriteBatch_and_moves_down_one_line_when_called_with_one_line() { _spriteFont.LineSpacing.Returns(15); var infoBar = new InfoBar(_spriteBatch, _spriteFont); const string text = "Test Message"; infoBar.DrawString(text); var expectedStartPosition = Vector2.Zero; _spriteBatch.Received(1).BeginBatch(); _spriteBatch.Received(1).DrawString(_spriteFont, text, expectedStartPosition, _expectedColor); _spriteBatch.Received(1).EndBatch(); var expectedEndPosition = expectedStartPosition + new Vector2(0, 15); Assert.AreEqual(expectedEndPosition, infoBar.CursorPosition); }
public void InfoBar_creates_new_infobar_with_default_properties() { var infoBar = new InfoBar(_spriteBatch, _spriteFont); Assert.AreEqual(infoBar.CursorPosition, Vector2.Zero); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { _effect = _contentManager.Load<Effect>("Effects/HLSLTest"); _effect.Parameters["AmbientColor"].SetValue(new Vector4(1.0f, 1.0f, 1.0f, 1.0f)); _effect.Parameters["AmbientProportion"].SetValue(0.5f); _effect.CurrentTechnique = _effect.Techniques["TestTechnique"]; var spriteBatch = new SpriteBatchWrapper(_graphicsDevice); var spriteFont = _contentManager.Load<SpriteFont>("Fonts/Segoe UI Mono"); var spriteFontWrapper = new SpriteFontWrapper(spriteFont); _infoBar = new InfoBar(spriteBatch, spriteFontWrapper); }