Esempio 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);
        }
    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);
    }
Esempio n. 3
0
        public void TestLocateOpeningBefore()
        {
            OpeningLocator locator = new OpeningLocator();

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

            Assert.AreEqual(0, openingIndex);
        }
Esempio 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);
        }
    public void TestLocateOpeningBefore() {
      OpeningLocator locator = new OpeningLocator();

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

      Assert.AreEqual(0, openingIndex);
    }
    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);
    }