This project is read-only.

Label with empty text

Mar 7, 2010 at 12:42 AM

Hi all.

I have a small problem with White - sometimes it can't find WinForms Label control, when label has empty text on form startup (Text = ""). 

I've tried this with NUnitForms - all is green, label is here:
ButtonTester button = new ButtonTester("button1");
LabelTester label = new LabelTester("label1");
Assert.That(label.Text, Is.EqualTo(String.Empty));
Assert.That(label.Text, Is.EqualTo("Bingo"));

But with White I need to do something like this:
 if (window.Get<Label>("label1") != null)
 Assert.That(window.Get<Label>("label1").Text, Is.EqualTo(String.Empty));

Does anyone know what's the problem?

Mar 25, 2010 at 1:34 AM

I do not have a answer but I'm finding that I'm unable to get access to any control that does not render.  e.g. empty text. The control does not appear in the document's items list until the control renders something.

First hit this problem when trying to test that the control was not visible  :-). Yea behaviour here is different in white. Unable to find the control implies that it is not visible. Anyhow that has been my experience.

Rob Smyth

Mar 26, 2010 at 5:01 PM
Edited Mar 26, 2010 at 5:04 PM

Thanx for reply, Rob

NUnitForms is not supported any more, so I decided to stay with White. Who knows, maybe this issue will be fixed soon :)
My solution was not to verify empty text. I was lucky to add more descriptive text to label. But anyway, this is a kind of bug in White.

Apr 10, 2010 at 11:59 AM

If you can submit some sample code to illustrate this problem then may be I can learn more and fix the issue if possible.