Exemplo n.º 1
0
        public void TestLocateOpeningOnSingleCharacter()
        {
            OpeningLocator locator = new OpeningLocator();

            Vector2 xSize = this.unitTestSpriteFont.MeasureString("X");

            int openingIndex = locator.FindClosestOpening(
                this.unitTestSpriteFont, "X", xSize.X / 3.0f
                );

            Assert.AreEqual(0, openingIndex);

            openingIndex = locator.FindClosestOpening(
                this.unitTestSpriteFont, "X", xSize.X / 3.0f * 2.0f
                );
            Assert.AreEqual(1, openingIndex);
        }
Exemplo n.º 2
0
    public void TestLocateOpeningWithin() {
      OpeningLocator locator = new OpeningLocator();

      Vector2 helloSize = this.unitTestSpriteFont.MeasureString("he");
      int openingIndex = locator.FindClosestOpening(
        this.unitTestSpriteFont, "hello world", helloSize.X
      );

      Assert.AreEqual(2, openingIndex);
    }
Exemplo n.º 3
0
        public void TestLocateOpeningBefore()
        {
            OpeningLocator locator = new OpeningLocator();

            int openingIndex = locator.FindClosestOpening(
                this.unitTestSpriteFont, "hello world", -10.0f
                );

            Assert.AreEqual(0, openingIndex);
        }
Exemplo n.º 4
0
        public void TestLocateOpeningWithin()
        {
            OpeningLocator locator = new OpeningLocator();

            Vector2 helloSize    = this.unitTestSpriteFont.MeasureString("he");
            int     openingIndex = locator.FindClosestOpening(
                this.unitTestSpriteFont, "hello world", helloSize.X
                );

            Assert.AreEqual(2, openingIndex);
        }
Exemplo n.º 5
0
    public void TestLocateOpeningBefore() {
      OpeningLocator locator = new OpeningLocator();

      int openingIndex = locator.FindClosestOpening(
        this.unitTestSpriteFont, "hello world", -10.0f
      );

      Assert.AreEqual(0, openingIndex);
    }
Exemplo n.º 6
0
    public void TestLocateOpeningOnSingleCharacter() {
      OpeningLocator locator = new OpeningLocator();

      Vector2 xSize = this.unitTestSpriteFont.MeasureString("X");

      int openingIndex = locator.FindClosestOpening(
        this.unitTestSpriteFont, "X", xSize.X / 3.0f
      );
      Assert.AreEqual(0, openingIndex);

      openingIndex = locator.FindClosestOpening(
        this.unitTestSpriteFont, "X", xSize.X / 3.0f * 2.0f
      );
      Assert.AreEqual(1, openingIndex);
    }