CP-6317: Importing from branch clearwater-ln.

# HG changeset patch
# User Konstantina Chremmou <Konstantina.Chremmou@citrix.com>
# Date 1377079306 -3600
# Node ID 170c7cbbbaefee729774ae21a3c417205708abee
# Parent  5bd4ebbd0553c160917192dd4546bb19a2a5a64d
CA-112226: Updated unit tests to reflect the changes in string measurement. Minor code tidy.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2013-09-26 14:40:35 +01:00
parent 864eeb48ee
commit d5486aaa1d
2 changed files with 9 additions and 13 deletions

View File

@ -122,14 +122,11 @@ namespace XenAdmin.Controls
if (autoEllipsis && newText != null)
{
using (Graphics g = CreateGraphics())
newText = newText.Ellipsise(new Rectangle(0, 0, maxWidth, Height), Font);
if (newText == ".") //If ellipsise shortens the string to less than the ellipsis
{
newText = newText.Ellipsise(new Rectangle(0, 0, maxWidth, Height), Font);
if (newText == ".") //If ellipsise shortens the string to less than the ellipsis
{
base.Text = String.Empty;
return;
}
base.Text = String.Empty;
return;
}
//Avoid sending &... to the base class, so ensure we have an even number of ampersands on the end of the string.

View File

@ -171,8 +171,8 @@ namespace XenAdminTests.Controls
yield return new TestCase { Text = "junk&", Expected = "junk&", Width = 50 };
yield return new TestCase { Text = "junk&", Expected = "junk&", Width = 100 };
yield return new TestCase { Text = "junk&&", Expected = "junk&&", Width = 100 };
yield return new TestCase { Text = "junk&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", Expected = "junk&&&&&&...", Width = 100 };
yield return new TestCase { Text = "jnk&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", Expected = "jnk&&&&&&&...", Width = 100 };
yield return new TestCase { Text = "junk&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", Expected = "junk&&&&&&&&&&&&&&&&&...", Width = 100 };
yield return new TestCase { Text = "jnk&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", Expected = "jnk&&&&&&&&&&&&&&&&&&&...", Width = 100 };
yield return new TestCase { Text = "junk&&junk", Expected = "junk&&junk", Width = 100 };
yield return new TestCase { Text = "junk&junk", Expected = "junk&junk", Width = 100 };
yield return new TestCase
@ -190,19 +190,18 @@ namespace XenAdminTests.Controls
}
}
public IEnumerable<TestCase> TestCasesNoMnemonic
{
get
{
yield return new TestCase { Text = "junk", Expected = "junk", Width = 100 };
yield return new TestCase { Text = "junk&", Expected = "ju...", Width = 50 };
yield return new TestCase { Text = "junk&", Expected = "junk&&", Width = 50 };
yield return new TestCase { Text = "junk&", Expected = "junk&&", Width = 100 };
yield return new TestCase { Text = "junk&&", Expected = "junk&&&&", Width = 100 };
yield return new TestCase { Text = "junk&&junk", Expected = "junk&&&&junk", Width = 100 };
yield return new TestCase { Text = "junk&junk", Expected = "junk&&junk", Width = 100 };
yield return new TestCase { Text = "junk&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", Expected = "junk&&&&&&...", Width = 100 };
yield return new TestCase { Text = "jnk&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", Expected = "jnk&&&&&&...", Width = 100 };
yield return new TestCase { Text = "junk&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", Expected = "junk&&&&&&&&&&&&&&&&...", Width = 100 };
yield return new TestCase { Text = "jnk&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", Expected = "jnk&&&&&&&&&&&&&&&&&&...", Width = 100 };
yield return new TestCase
{
Text = "AllWorkAndNoPlayMakesJackADullBoyAllWorkAndNoPlayMakesJackADullBoyAllWorkAndNoPlayMakesJackADullBoy",