xref: /haiku/src/tests/kits/interface/balert/AlertTest.cpp (revision db441663b359e7dbbebe275b8cff3e9f88c426ce)
1 // AlertTest.cpp
2 #include "AlertTest.h"
3 #include <cppunit/Test.h>
4 #include <cppunit/TestCaller.h>
5 #include <cppunit/TestSuite.h>
6 #include <iostream.h>
7 #include <stdio.h>
8 #include <string.h>
9 #include <Application.h>
10 #include <Alert.h>
11 #include <Point.h>
12 #include <TextView.h>
13 #include <Button.h>
14 #include <Rect.h>
15 
16 #define ASSERT_DEQUAL(x,y) CPPUNIT_ASSERT_DOUBLES_EQUAL((x),(y),0.01)
17 
18 const char *k20X = "XXXXXXXXXXXXXXXXXXXX";
19 const char *k40X = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
20 const char *k60X = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
21 
22 // Required by CPPUNIT_ASSERT_EQUAL(rgb_color, rgb_color)
23 bool operator==(const rgb_color &left, const rgb_color &right)
24 {
25 	if (left.red == right.red && left.green == right.green &&
26 	    left.blue == right.blue && left.alpha == right.alpha)
27 	    return true;
28 	else
29 		return false;
30 }
31 // Required by CPPUNIT_ASSERT_EQUAL(rgb_color, rgb_color)
32 ostream &operator<<(ostream &stream, const rgb_color &clr)
33 {
34 	return stream << "rgb_color(" << clr.red << ", " <<
35 		clr.green << ", " << clr.blue << ", " << clr.alpha << ")";
36 }
37 
38 // For storing expected state of windows or views.
39 struct GuiInfo {
40 	const char*	label;
41 	float		width;
42 	float		height;
43 	BPoint		topleft;
44 };
45 
46 // For storing all the information required to create and
47 // verify the state of a BAlert object.
48 class AlertTestInfo {
49 public:
50 	AlertTestInfo(AlertTest *pTest);
51 	~AlertTestInfo();
52 
53 	void SetWinInfo(const GuiInfo &winInfo);
54 	void SetTextViewInfo(const GuiInfo &textInfo);
55 	void SetButtonInfo(int32 btn, const GuiInfo &btnInfo);
56 
57 	void SetButtonWidthMode(button_width widthMode);
58 	void SetButtonSpacingMode(button_spacing spacingMode);
59 	void SetAlertType(alert_type alertType);
60 
61 	void GuiInfoTest();
62 
63 private:
64 	AlertTest*		fTest;
65 	GuiInfo			fWinInfo;
66 	GuiInfo			fTextInfo;
67 	GuiInfo			fButtonInfo[3];
68 	int32 			fButtonCount;
69 	button_width	fWidthMode;
70 	button_spacing	fSpacingMode;
71 	alert_type		fAlertType;
72 };
73 
74 AlertTestInfo::AlertTestInfo(AlertTest *pTest)
75 {
76 	memset(this, 0, sizeof(AlertTestInfo));
77 
78 	fTest = pTest;
79 	fWidthMode = B_WIDTH_AS_USUAL;
80 	fSpacingMode = B_EVEN_SPACING;
81 	fAlertType = B_INFO_ALERT;
82 }
83 
84 AlertTestInfo::~AlertTestInfo()
85 {
86 	fTest = NULL;
87 	fButtonCount = 0;
88 }
89 
90 void
91 AlertTestInfo::SetWinInfo(const GuiInfo &winInfo)
92 {
93 	fWinInfo = winInfo;
94 }
95 
96 void
97 AlertTestInfo::SetTextViewInfo(const GuiInfo &textInfo)
98 {
99 	fTextInfo = textInfo;
100 }
101 
102 void
103 AlertTestInfo::SetButtonInfo(int32 btn, const GuiInfo &btnInfo)
104 {
105 	if (btn < 0 || btn > 2 || btn > fButtonCount) {
106 		CPPUNIT_ASSERT(false);
107 		return;
108 	}
109 	fButtonInfo[btn] = btnInfo;
110 	if (btn == fButtonCount && fButtonCount < 3)
111 		fButtonCount++;
112 }
113 
114 void
115 AlertTestInfo::SetButtonWidthMode(button_width widthMode)
116 {
117 	fWidthMode = widthMode;
118 }
119 
120 void
121 AlertTestInfo::SetButtonSpacingMode(button_spacing spacingMode)
122 {
123 	fSpacingMode = spacingMode;
124 }
125 
126 void
127 AlertTestInfo::SetAlertType(alert_type alertType)
128 {
129 	fAlertType = alertType;
130 }
131 
132 void
133 AlertTestInfo::GuiInfoTest()
134 {
135 	fTest->NextSubTest();
136 	// Dummy application object required to create Window objects.
137 	BApplication app("application/x-vnd.Haiku-interfacekit_alerttest");
138 	BAlert *pAlert = new BAlert(
139 		fWinInfo.label,
140 		fTextInfo.label,
141 		fButtonInfo[0].label,
142 		fButtonInfo[1].label,
143 		fButtonInfo[2].label,
144 		fWidthMode,
145 		fSpacingMode,
146 		fAlertType
147 	);
148 	CPPUNIT_ASSERT(pAlert);
149 
150 	// Alert Window Width/Height
151 	fTest->NextSubTest();
152 	ASSERT_DEQUAL(fWinInfo.width, pAlert->Bounds().Width());
153 	ASSERT_DEQUAL(fWinInfo.height, pAlert->Bounds().Height());
154 
155 	// [k] MasterView
156 	fTest->NextSubTest();
157 	BView *masterView = pAlert->ChildAt(0);
158 	CPPUNIT_ASSERT(masterView);
159 
160 	// [k] MasterView Color
161 	fTest->NextSubTest();
162 	CPPUNIT_ASSERT_EQUAL(ui_color(B_PANEL_BACKGROUND_COLOR),
163 		masterView->ViewColor());
164 
165 	// Test all the buttons
166 	BButton *btns[3] = { NULL };
167 	for (int32 i = 0; i < 3; i++) {
168 		fTest->NextSubTest();
169 		btns[i] = pAlert->ButtonAt(i);
170 
171 		if (i >= fButtonCount) {
172 			// If there is should be no button at this index
173 			CPPUNIT_ASSERT_EQUAL((BButton*)NULL, btns[i]);
174 		} else {
175 			// If there should be a button at this index
176 			CPPUNIT_ASSERT(btns[i]);
177 
178 			CPPUNIT_ASSERT(
179 				strcmp(fButtonInfo[i].label, btns[i]->Label()) == 0);
180 
181 			ASSERT_DEQUAL(fButtonInfo[i].width, btns[i]->Bounds().Width());
182 
183 			ASSERT_DEQUAL(fButtonInfo[i].height, btns[i]->Bounds().Height());
184 
185 			BPoint pt = btns[i]->ConvertToParent(BPoint(0, 0));
186 			ASSERT_DEQUAL(fButtonInfo[i].topleft.x, pt.x);
187 			ASSERT_DEQUAL(fButtonInfo[i].topleft.y, pt.y);
188 
189 			if (i == fButtonCount - 1) {
190 				// Default button
191 				CPPUNIT_ASSERT_EQUAL(true, btns[i]->IsDefault());
192 			}
193 		}
194 	}
195 
196 	// [k] TextView
197 	fTest->NextSubTest();
198 	BTextView *textView = pAlert->TextView();
199 	CPPUNIT_ASSERT(textView);
200 
201 	// [k] TextView ViewColor()
202 	fTest->NextSubTest();
203 	CPPUNIT_ASSERT_EQUAL(ui_color(B_PANEL_BACKGROUND_COLOR), textView->ViewColor());
204 
205 	// [k] TextView IsEditable()
206 	fTest->NextSubTest();
207 	CPPUNIT_ASSERT_EQUAL(false, textView->IsEditable());
208 
209 	// [k] TextView IsSelectable()
210 	fTest->NextSubTest();
211 	CPPUNIT_ASSERT_EQUAL(false, textView->IsSelectable());
212 
213 	// [k] TextView DoesWordWrap()
214 	fTest->NextSubTest();
215 	CPPUNIT_ASSERT_EQUAL(true, textView->DoesWordWrap());
216 
217 	// TextView Text
218 	fTest->NextSubTest();
219 	CPPUNIT_ASSERT(strcmp(fTextInfo.label, textView->Text()) == 0);
220 
221 	// TextView Width/Height
222 	fTest->NextSubTest();
223 	ASSERT_DEQUAL(fTextInfo.width, textView->Bounds().Width());
224 	ASSERT_DEQUAL(fTextInfo.height, textView->Bounds().Height());
225 
226 	// TextView Position
227 	fTest->NextSubTest();
228 	BPoint pt = textView->ConvertToParent(BPoint(0, 0));
229 	ASSERT_DEQUAL(fTextInfo.topleft.x, pt.x);
230 	ASSERT_DEQUAL(fTextInfo.topleft.y, pt.y);
231 
232 	delete pAlert;
233 	pAlert = NULL;
234 }
235 
236 // Suite
237 CppUnit::Test *
238 AlertTest::Suite()
239 {
240 	CppUnit::TestSuite *suite = new CppUnit::TestSuite();
241 	typedef CppUnit::TestCaller<AlertTest> TC;
242 
243 #define AT_ADDTEST(fn) (suite->addTest(new TC("Alert " #fn, &AlertTest::fn)))
244 
245 	////// UW_ES_IA - One Button //////
246 	AT_ADDTEST(empty_empty_UW_ES_IA);
247 	AT_ADDTEST(OK_X_UW_ES_IA);
248 	AT_ADDTEST(OK_60X_UW_ES_IA);
249 	AT_ADDTEST(twentyX_60X_UW_ES_IA);
250 	AT_ADDTEST(fortyX_60X_UW_ES_IA);
251 
252 	////// LW_ES_IA - One Button //////
253 	AT_ADDTEST(empty_empty_LW_ES_IA);
254 	AT_ADDTEST(OK_X_LW_ES_IA);
255 	AT_ADDTEST(twentyX_60X_LW_ES_IA);
256 	AT_ADDTEST(fortyX_60X_LW_ES_IA);
257 
258 	////// UW_ES_EA - One Button //////
259 	AT_ADDTEST(OK_X_UW_ES_EA);
260 	AT_ADDTEST(fortyX_60X_UW_ES_EA);
261 
262 	////// UW_ES_IA - Two Button //////
263 	AT_ADDTEST(OK_Cancel_60X_UW_ES_IA);
264 	AT_ADDTEST(twentyX_Cancel_60X_UW_ES_IA);
265 	AT_ADDTEST(twentyX_20X_60X_UW_ES_IA);
266 
267 	////// LW_ES_IA - Two Button //////
268 	AT_ADDTEST(empty_empty_X_LW_ES_IA);
269 	AT_ADDTEST(OK_Cancel_60X_LW_ES_IA);
270 
271 	////// UW_ES_EA - Two Button //////
272 	AT_ADDTEST(OK_Cancel_60X_UW_ES_EA);
273 	AT_ADDTEST(twentyX_20X_60X_UW_ES_EA);
274 
275 	////// UW_ES_IA - Three Button //////
276 	AT_ADDTEST(twentyX_20X_20X_60X_UW_ES_IA);
277 
278 	////// LW_ES_IA - Three Button //////
279 	AT_ADDTEST(empty_empty_empty_X_LW_ES_IA);
280 	AT_ADDTEST(Yes_No_Cancel_X_LW_ES_IA);
281 	AT_ADDTEST(twentyX_20X_20X_60X_LW_ES_IA);
282 
283 	////// UW_ES_EA - Three Button //////
284 	AT_ADDTEST(twentyX_20X_20X_60X_UW_ES_EA);
285 
286 	return suite;
287 }
288 
289 // setUp
290 void
291 AlertTest::setUp()
292 {
293 	BTestCase::setUp();
294 }
295 
296 // tearDown
297 void
298 AlertTest::tearDown()
299 {
300 	BTestCase::tearDown();
301 }
302 
303 ////// UW_ES_IA - One Button //////
304 
305 void
306 AlertTest::empty_empty_UW_ES_IA()
307 {
308 	AlertTestInfo ati(this);
309 	GuiInfo wi, ti, bi;
310 	wi.label = "alert1";
311 	wi.width = 310.0f;
312 	wi.height = 64.0f;
313 	ati.SetWinInfo(wi);
314 
315 	ti.label = "";
316 	ti.width = 245.0f;
317 	ti.height = 13.0f;
318 	ti.topleft.Set(55.0f, 6.0f);
319 	ati.SetTextViewInfo(ti);
320 
321 	bi.label = "";
322 	bi.width = 75.0f;
323 	bi.height = 30.0f;
324 	bi.topleft.Set(229.0f, 28.0f);
325 	ati.SetButtonInfo(0, bi);
326 
327 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
328 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
329 	ati.SetAlertType(B_INFO_ALERT);
330 
331 	ati.GuiInfoTest();
332 }
333 
334 void
335 AlertTest::OK_X_UW_ES_IA()
336 {
337 	AlertTestInfo ati(this);
338 	GuiInfo wi, ti, bi;
339 	wi.label = "alert1";
340 	wi.width = 310.0f;
341 	wi.height = 64.0f;
342 	ati.SetWinInfo(wi);
343 
344 	ti.label = "X";
345 	ti.width = 245.0f;
346 	ti.height = 13.0f;
347 	ti.topleft.Set(55.0f, 6.0f);
348 	ati.SetTextViewInfo(ti);
349 
350 	bi.label = "OK";
351 	bi.width = 75.0f;
352 	bi.height = 30.0f;
353 	bi.topleft.Set(229.0f, 28.0f);
354 	ati.SetButtonInfo(0, bi);
355 
356 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
357 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
358 	ati.SetAlertType(B_INFO_ALERT);
359 
360 	ati.GuiInfoTest();
361 }
362 
363 void
364 AlertTest::OK_60X_UW_ES_IA()
365 {
366 	AlertTestInfo ati(this);
367 	GuiInfo wi, ti, bi;
368 	wi.label = "alert1";
369 	wi.width = 310.0f;
370 	wi.height = 77.0f;
371 	ati.SetWinInfo(wi);
372 
373 	ti.label = k60X;
374 	ti.width = 245.0f;
375 	ti.height = 26.0f;
376 	ti.topleft.Set(55.0f, 6.0f);
377 	ati.SetTextViewInfo(ti);
378 
379 	bi.label = "OK";
380 	bi.width = 75.0f;
381 	bi.height = 30.0f;
382 	bi.topleft.Set(229.0f, 41.0f);
383 	ati.SetButtonInfo(0, bi);
384 
385 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
386 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
387 	ati.SetAlertType(B_INFO_ALERT);
388 
389 	ati.GuiInfoTest();
390 }
391 
392 void
393 AlertTest::twentyX_60X_UW_ES_IA()
394 {
395 	AlertTestInfo ati(this);
396 	GuiInfo wi, ti, bi;
397 	wi.label = "alert1";
398 	wi.width = 310.0f;
399 	wi.height = 77.0f;
400 	ati.SetWinInfo(wi);
401 
402 	ti.label = k60X;
403 	ti.width = 245.0f;
404 	ti.height = 26.0f;
405 	ti.topleft.Set(55.0f, 6.0f);
406 	ati.SetTextViewInfo(ti);
407 
408 	bi.label = k20X;
409 	bi.width = 160.0f;
410 	bi.height = 30.0f;
411 	bi.topleft.Set(144.0f, 41.0f);
412 	ati.SetButtonInfo(0, bi);
413 
414 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
415 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
416 	ati.SetAlertType(B_INFO_ALERT);
417 
418 	ati.GuiInfoTest();
419 }
420 
421 void
422 AlertTest::fortyX_60X_UW_ES_IA()
423 {
424 	AlertTestInfo ati(this);
425 	GuiInfo wi, ti, bi;
426 	wi.label = "alert1";
427 	wi.width = 365.0f;
428 	wi.height = 77.0f;
429 	ati.SetWinInfo(wi);
430 
431 	ti.label = k60X;
432 	ti.width = 300.0f;
433 	ti.height = 26.0f;
434 	ti.topleft.Set(55.0f, 6.0f);
435 	ati.SetTextViewInfo(ti);
436 
437 	bi.label = k40X;
438 	bi.width = 300.0f;
439 	bi.height = 30.0f;
440 	bi.topleft.Set(59.0f, 41.0f);
441 	ati.SetButtonInfo(0, bi);
442 
443 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
444 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
445 	ati.SetAlertType(B_INFO_ALERT);
446 
447 	ati.GuiInfoTest();
448 }
449 
450 ////// LW_ES_IA - One Button //////
451 
452 void
453 AlertTest::empty_empty_LW_ES_IA()
454 {
455 	AlertTestInfo ati(this);
456 	GuiInfo wi, ti, bi;
457 	wi.label = "alert1";
458 	wi.width = 310.0f;
459 	wi.height = 64.0f;
460 	ati.SetWinInfo(wi);
461 
462 	ti.label = "";
463 	ti.width = 245.0f;
464 	ti.height = 13.0f;
465 	ti.topleft.Set(55.0f, 6.0f);
466 	ati.SetTextViewInfo(ti);
467 
468 	bi.label = "";
469 	bi.width = 20.0f;
470 	bi.height = 30.0f;
471 	bi.topleft.Set(284.0f, 28.0f);
472 	ati.SetButtonInfo(0, bi);
473 
474 	ati.SetButtonWidthMode(B_WIDTH_FROM_LABEL);
475 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
476 	ati.SetAlertType(B_INFO_ALERT);
477 
478 	ati.GuiInfoTest();
479 }
480 
481 void
482 AlertTest::OK_X_LW_ES_IA()
483 {
484 	AlertTestInfo ati(this);
485 	GuiInfo wi, ti, bi;
486 	wi.label = "alert1";
487 	wi.width = 310.0f;
488 	wi.height = 64.0f;
489 	ati.SetWinInfo(wi);
490 
491 	ti.label = "X";
492 	ti.width = 245.0f;
493 	ti.height = 13.0f;
494 	ti.topleft.Set(55.0f, 6.0f);
495 	ati.SetTextViewInfo(ti);
496 
497 	bi.label = "OK";
498 	bi.width = 35.0f;
499 	bi.height = 30.0f;
500 	bi.topleft.Set(269.0f, 28.0f);
501 	ati.SetButtonInfo(0, bi);
502 
503 	ati.SetButtonWidthMode(B_WIDTH_FROM_LABEL);
504 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
505 	ati.SetAlertType(B_INFO_ALERT);
506 
507 	ati.GuiInfoTest();
508 }
509 
510 void
511 AlertTest::twentyX_60X_LW_ES_IA()
512 {
513 	AlertTestInfo ati(this);
514 	GuiInfo wi, ti, bi;
515 	wi.label = "alert1";
516 	wi.width = 310.0f;
517 	wi.height = 77.0f;
518 	ati.SetWinInfo(wi);
519 
520 	ti.label = k60X;
521 	ti.width = 245.0f;
522 	ti.height = 26.0f;
523 	ti.topleft.Set(55.0f, 6.0f);
524 	ati.SetTextViewInfo(ti);
525 
526 	bi.label = k20X;
527 	bi.width = 160.0f;
528 	bi.height = 30.0f;
529 	bi.topleft.Set(144.0f, 41.0f);
530 	ati.SetButtonInfo(0, bi);
531 
532 	ati.SetButtonWidthMode(B_WIDTH_FROM_LABEL);
533 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
534 	ati.SetAlertType(B_INFO_ALERT);
535 
536 	ati.GuiInfoTest();
537 }
538 
539 void
540 AlertTest::fortyX_60X_LW_ES_IA()
541 {
542 	AlertTestInfo ati(this);
543 	GuiInfo wi, ti, bi;
544 	wi.label = "alert1";
545 	wi.width = 365.0f;
546 	wi.height = 77.0f;
547 	ati.SetWinInfo(wi);
548 
549 	ti.label = k60X;
550 	ti.width = 300.0f;
551 	ti.height = 26.0f;
552 	ti.topleft.Set(55.0f, 6.0f);
553 	ati.SetTextViewInfo(ti);
554 
555 	bi.label = k40X;
556 	bi.width = 300.0f;
557 	bi.height = 30.0f;
558 	bi.topleft.Set(59.0f, 41.0f);
559 	ati.SetButtonInfo(0, bi);
560 
561 	ati.SetButtonWidthMode(B_WIDTH_FROM_LABEL);
562 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
563 	ati.SetAlertType(B_INFO_ALERT);
564 
565 	ati.GuiInfoTest();
566 }
567 
568 ////// UW_ES_EA - One Button //////
569 
570 void
571 AlertTest::OK_X_UW_ES_EA()
572 {
573 	AlertTestInfo ati(this);
574 	GuiInfo wi, ti, bi;
575 	wi.label = "alert1";
576 	wi.width = 310.0f;
577 	wi.height = 64.0f;
578 	ati.SetWinInfo(wi);
579 
580 	ti.label = "X";
581 	ti.width = 290.0f;
582 	ti.height = 13.0f;
583 	ti.topleft.Set(10.0f, 6.0f);
584 	ati.SetTextViewInfo(ti);
585 
586 	bi.label = "OK";
587 	bi.width = 75.0f;
588 	bi.height = 30.0f;
589 	bi.topleft.Set(229.0f, 28.0f);
590 	ati.SetButtonInfo(0, bi);
591 
592 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
593 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
594 	ati.SetAlertType(B_EMPTY_ALERT);
595 
596 	ati.GuiInfoTest();
597 }
598 
599 void
600 AlertTest::fortyX_60X_UW_ES_EA()
601 {
602 	AlertTestInfo ati(this);
603 	GuiInfo wi, ti, bi;
604 	wi.label = "alert1";
605 	wi.width = 320.0f;
606 	wi.height = 77.0f;
607 	ati.SetWinInfo(wi);
608 
609 	ti.label = k60X;
610 	ti.width = 300.0f;
611 	ti.height = 26.0f;
612 	ti.topleft.Set(10.0f, 6.0f);
613 	ati.SetTextViewInfo(ti);
614 
615 	bi.label = k40X;
616 	bi.width = 300.0f;
617 	bi.height = 30.0f;
618 	bi.topleft.Set(14.0f, 41.0f);
619 	ati.SetButtonInfo(0, bi);
620 
621 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
622 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
623 	ati.SetAlertType(B_EMPTY_ALERT);
624 
625 	ati.GuiInfoTest();
626 }
627 
628 ////// UW_ES_IA - Two Button //////
629 
630 void
631 AlertTest::OK_Cancel_60X_UW_ES_IA()
632 {
633 	AlertTestInfo ati(this);
634 	GuiInfo wi, ti, bi;
635 	wi.label = "alert1";
636 	wi.width = 310.0f;
637 	wi.height = 77.0f;
638 	ati.SetWinInfo(wi);
639 
640 	ti.label = k60X;
641 	ti.width = 245.0f;
642 	ti.height = 26.0f;
643 	ti.topleft.Set(55.0f, 6.0f);
644 	ati.SetTextViewInfo(ti);
645 
646 	bi.label = "OK";
647 	bi.width = 75.0f;
648 	bi.height = 24.0f;
649 	bi.topleft.Set(148.0f, 44.0f);
650 	ati.SetButtonInfo(0, bi);
651 	bi.label = "Cancel";
652 	bi.width = 75.0f;
653 	bi.height = 30.0f;
654 	bi.topleft.Set(229.0f, 41.0f);
655 	ati.SetButtonInfo(1, bi);
656 
657 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
658 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
659 	ati.SetAlertType(B_INFO_ALERT);
660 
661 	ati.GuiInfoTest();
662 }
663 
664 void
665 AlertTest::twentyX_Cancel_60X_UW_ES_IA()
666 {
667 	AlertTestInfo ati(this);
668 	GuiInfo wi, ti, bi;
669 	wi.label = "alert1";
670 	wi.width = 310.0f;
671 	wi.height = 77.0f;
672 	ati.SetWinInfo(wi);
673 
674 	ti.label = k60X;
675 	ti.width = 245.0f;
676 	ti.height = 26.0f;
677 	ti.topleft.Set(55.0f, 6.0f);
678 	ati.SetTextViewInfo(ti);
679 
680 	bi.label = k20X;
681 	bi.width = 160.0f;
682 	bi.height = 24.0f;
683 	bi.topleft.Set(63.0f, 44.0f);
684 	ati.SetButtonInfo(0, bi);
685 	bi.label = "Cancel";
686 	bi.width = 75.0f;
687 	bi.height = 30.0f;
688 	bi.topleft.Set(229.0f, 41.0f);
689 	ati.SetButtonInfo(1, bi);
690 
691 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
692 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
693 	ati.SetAlertType(B_INFO_ALERT);
694 
695 	ati.GuiInfoTest();
696 }
697 
698 void
699 AlertTest::twentyX_20X_60X_UW_ES_IA()
700 {
701 	AlertTestInfo ati(this);
702 	GuiInfo wi, ti, bi;
703 	wi.label = "alert1";
704 	wi.width = 394.0f;
705 	wi.height = 77.0f;
706 	ati.SetWinInfo(wi);
707 
708 	ti.label = k60X;
709 	ti.width = 329.0f;
710 	ti.height = 26.0f;
711 	ti.topleft.Set(55.0f, 6.0f);
712 	ati.SetTextViewInfo(ti);
713 
714 	bi.label = k20X;
715 	bi.width = 160.0f;
716 	bi.height = 24.0f;
717 	bi.topleft.Set(62.0f, 44.0f);
718 	ati.SetButtonInfo(0, bi);
719 	bi.label = k20X;
720 	bi.width = 160.0f;
721 	bi.height = 30.0f;
722 	bi.topleft.Set(228.0f, 41.0f);
723 	ati.SetButtonInfo(1, bi);
724 
725 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
726 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
727 	ati.SetAlertType(B_INFO_ALERT);
728 
729 	ati.GuiInfoTest();
730 }
731 
732 ////// LW_ES_IA - Two Button //////
733 
734 void
735 AlertTest::empty_empty_X_LW_ES_IA()
736 {
737 	AlertTestInfo ati(this);
738 	GuiInfo wi, ti, bi;
739 	wi.label = "alert1";
740 	wi.width = 310.0f;
741 	wi.height = 64.0f;
742 	ati.SetWinInfo(wi);
743 
744 	ti.label = "X";
745 	ti.width = 245.0f;
746 	ti.height = 13.0f;
747 	ti.topleft.Set(55.0f, 6.0f);
748 	ati.SetTextViewInfo(ti);
749 
750 	bi.label = "";
751 	bi.width = 20.0f;
752 	bi.height = 24.0f;
753 	bi.topleft.Set(258.0f, 31.0f);
754 	ati.SetButtonInfo(0, bi);
755 	bi.label = "";
756 	bi.width = 20.0f;
757 	bi.height = 30.0f;
758 	bi.topleft.Set(284.0f, 28.0f);
759 	ati.SetButtonInfo(1, bi);
760 
761 	ati.SetButtonWidthMode(B_WIDTH_FROM_LABEL);
762 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
763 	ati.SetAlertType(B_INFO_ALERT);
764 
765 	ati.GuiInfoTest();
766 }
767 
768 void
769 AlertTest::OK_Cancel_60X_LW_ES_IA()
770 {
771 	AlertTestInfo ati(this);
772 	GuiInfo wi, ti, bi;
773 	wi.label = "alert1";
774 	wi.width = 310.0f;
775 	wi.height = 77.0f;
776 	ati.SetWinInfo(wi);
777 
778 	ti.label = k60X;
779 	ti.width = 245.0f;
780 	ti.height = 26.0f;
781 	ti.topleft.Set(55.0f, 6.0f);
782 	ati.SetTextViewInfo(ti);
783 
784 	bi.label = "OK";
785 	bi.width = 35.0f;
786 	bi.height = 24.0f;
787 	bi.topleft.Set(211.0f, 44.0f);
788 	ati.SetButtonInfo(0, bi);
789 	bi.label = "Cancel";
790 	bi.width = 52.0f;
791 	bi.height = 30.0f;
792 	bi.topleft.Set(252.0f, 41.0f);
793 	ati.SetButtonInfo(1, bi);
794 
795 	ati.SetButtonWidthMode(B_WIDTH_FROM_LABEL);
796 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
797 	ati.SetAlertType(B_INFO_ALERT);
798 
799 	ati.GuiInfoTest();
800 }
801 
802 
803 ////// UW_ES_EA - Two Button //////
804 
805 void
806 AlertTest::OK_Cancel_60X_UW_ES_EA()
807 {
808 	AlertTestInfo ati(this);
809 	GuiInfo wi, ti, bi;
810 	wi.label = "alert1";
811 	wi.width = 310.0f;
812 	wi.height = 77.0f;
813 	ati.SetWinInfo(wi);
814 
815 	ti.label = k60X;
816 	ti.width = 290.0f;
817 	ti.height = 26.0f;
818 	ti.topleft.Set(10.0f, 6.0f);
819 	ati.SetTextViewInfo(ti);
820 
821 	bi.label = "OK";
822 	bi.width = 75.0f;
823 	bi.height = 24.0f;
824 	bi.topleft.Set(148.0f, 44.0f);
825 	ati.SetButtonInfo(0, bi);
826 	bi.label = "Cancel";
827 	bi.width = 75.0f;
828 	bi.height = 30.0f;
829 	bi.topleft.Set(229.0f, 41.0f);
830 	ati.SetButtonInfo(1, bi);
831 
832 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
833 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
834 	ati.SetAlertType(B_EMPTY_ALERT);
835 
836 	ati.GuiInfoTest();
837 }
838 
839 void
840 AlertTest::twentyX_20X_60X_UW_ES_EA()
841 {
842 	AlertTestInfo ati(this);
843 	GuiInfo wi, ti, bi;
844 	wi.label = "alert1";
845 	wi.width = 349.0f;
846 	wi.height = 77.0f;
847 	ati.SetWinInfo(wi);
848 
849 	ti.label = k60X;
850 	ti.width = 329.0f;
851 	ti.height = 26.0f;
852 	ti.topleft.Set(10.0f, 6.0f);
853 	ati.SetTextViewInfo(ti);
854 
855 	bi.label = k20X;
856 	bi.width = 160.0f;
857 	bi.height = 24.0f;
858 	bi.topleft.Set(17.0f, 44.0f);
859 	ati.SetButtonInfo(0, bi);
860 	bi.label = k20X;
861 	bi.width = 160.0f;
862 	bi.height = 30.0f;
863 	bi.topleft.Set(183.0f, 41.0f);
864 	ati.SetButtonInfo(1, bi);
865 
866 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
867 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
868 	ati.SetAlertType(B_EMPTY_ALERT);
869 
870 	ati.GuiInfoTest();
871 }
872 
873 
874 ////// UW_ES_IA - Three Button //////
875 
876 void
877 AlertTest::twentyX_20X_20X_60X_UW_ES_IA()
878 {
879 	AlertTestInfo ati(this);
880 	GuiInfo wi, ti, bi;
881 	wi.label = "alert1";
882 	wi.width = 563.0f;
883 	wi.height = 64.0f;
884 	ati.SetWinInfo(wi);
885 
886 	ti.label = k60X;
887 	ti.width = 498.0f;
888 	ti.height = 13.0f;
889 	ti.topleft.Set(55.0f, 6.0f);
890 	ati.SetTextViewInfo(ti);
891 
892 	bi.label = k20X;
893 	bi.width = 160.0f;
894 	bi.height = 24.0f;
895 	bi.topleft.Set(62.0f, 31.0f);
896 	ati.SetButtonInfo(0, bi);
897 	bi.label = k20X;
898 	bi.width = 160.0f;
899 	bi.height = 24.0f;
900 	bi.topleft.Set(231.0f, 31.0f);
901 	ati.SetButtonInfo(1, bi);
902 	bi.label = k20X;
903 	bi.width = 160.0f;
904 	bi.height = 30.0f;
905 	bi.topleft.Set(397.0f, 28.0f);
906 	ati.SetButtonInfo(2, bi);
907 
908 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
909 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
910 	ati.SetAlertType(B_INFO_ALERT);
911 
912 	ati.GuiInfoTest();
913 }
914 
915 ////// LW_ES_IA - Three Button //////
916 
917 void
918 AlertTest::empty_empty_empty_X_LW_ES_IA()
919 {
920 	AlertTestInfo ati(this);
921 	GuiInfo wi, ti, bi;
922 	wi.label = "alert1";
923 	wi.width = 310.0f;
924 	wi.height = 64.0f;
925 	ati.SetWinInfo(wi);
926 
927 	ti.label = "X";
928 	ti.width = 245.0f;
929 	ti.height = 13.0f;
930 	ti.topleft.Set(55.0f, 6.0f);
931 	ati.SetTextViewInfo(ti);
932 
933 	bi.label = "";
934 	bi.width = 20.0f;
935 	bi.height = 24.0f;
936 	bi.topleft.Set(229.0f, 31.0f);
937 	ati.SetButtonInfo(0, bi);
938 	bi.label = "";
939 	bi.width = 20.0f;
940 	bi.height = 24.0f;
941 	bi.topleft.Set(258.0f, 31.0f);
942 	ati.SetButtonInfo(1, bi);
943 	bi.label = "";
944 	bi.width = 20.0f;
945 	bi.height = 30.0f;
946 	bi.topleft.Set(284.0f, 28.0f);
947 	ati.SetButtonInfo(2, bi);
948 
949 	ati.SetButtonWidthMode(B_WIDTH_FROM_LABEL);
950 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
951 	ati.SetAlertType(B_INFO_ALERT);
952 
953 	ati.GuiInfoTest();
954 }
955 
956 void
957 AlertTest::Yes_No_Cancel_X_LW_ES_IA()
958 {
959 	AlertTestInfo ati(this);
960 	GuiInfo wi, ti, bi;
961 	wi.label = "alert1";
962 	wi.width = 310.0f;
963 	wi.height = 64.0f;
964 	ati.SetWinInfo(wi);
965 
966 	ti.label = "X";
967 	ti.width = 245.0f;
968 	ti.height = 13.0f;
969 	ti.topleft.Set(55.0f, 6.0f);
970 	ati.SetTextViewInfo(ti);
971 
972 	bi.label = "Yes";
973 	bi.width = 37.0f;
974 	bi.height = 24.0f;
975 	bi.topleft.Set(167.0f, 31.0f);
976 	ati.SetButtonInfo(0, bi);
977 	bi.label = "No";
978 	bi.width = 33.0f;
979 	bi.height = 24.0f;
980 	bi.topleft.Set(213.0f, 31.0f);
981 	ati.SetButtonInfo(1, bi);
982 	bi.label = "Cancel";
983 	bi.width = 52.0f;
984 	bi.height = 30.0f;
985 	bi.topleft.Set(252.0f, 28.0f);
986 	ati.SetButtonInfo(2, bi);
987 
988 	ati.SetButtonWidthMode(B_WIDTH_FROM_LABEL);
989 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
990 	ati.SetAlertType(B_INFO_ALERT);
991 
992 	ati.GuiInfoTest();
993 }
994 
995 void
996 AlertTest::twentyX_20X_20X_60X_LW_ES_IA()
997 {
998 	AlertTestInfo ati(this);
999 	GuiInfo wi, ti, bi;
1000 	wi.label = "alert1";
1001 	wi.width = 563.0f;
1002 	wi.height = 64.0f;
1003 	ati.SetWinInfo(wi);
1004 
1005 	ti.label = k60X;
1006 	ti.width = 498.0f;
1007 	ti.height = 13.0f;
1008 	ti.topleft.Set(55.0f, 6.0f);
1009 	ati.SetTextViewInfo(ti);
1010 
1011 	bi.label = k20X;
1012 	bi.width = 160.0f;
1013 	bi.height = 24.0f;
1014 	bi.topleft.Set(62.0f, 31.0f);
1015 	ati.SetButtonInfo(0, bi);
1016 	bi.label = k20X;
1017 	bi.width = 160.0f;
1018 	bi.height = 24.0f;
1019 	bi.topleft.Set(231.0f, 31.0f);
1020 	ati.SetButtonInfo(1, bi);
1021 	bi.label = k20X;
1022 	bi.width = 160.0f;
1023 	bi.height = 30.0f;
1024 	bi.topleft.Set(397.0f, 28.0f);
1025 	ati.SetButtonInfo(2, bi);
1026 
1027 	ati.SetButtonWidthMode(B_WIDTH_FROM_LABEL);
1028 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
1029 	ati.SetAlertType(B_INFO_ALERT);
1030 
1031 	ati.GuiInfoTest();
1032 }
1033 
1034 ////// UW_ES_EA - Three Button //////
1035 
1036 void
1037 AlertTest::twentyX_20X_20X_60X_UW_ES_EA()
1038 {
1039 	AlertTestInfo ati(this);
1040 	GuiInfo wi, ti, bi;
1041 	wi.label = "alert1";
1042 	wi.width = 518.0f;
1043 	wi.height = 64.0f;
1044 	ati.SetWinInfo(wi);
1045 
1046 	ti.label = k60X;
1047 	ti.width = 498.0f;
1048 	ti.height = 13.0f;
1049 	ti.topleft.Set(10.0f, 6.0f);
1050 	ati.SetTextViewInfo(ti);
1051 
1052 	bi.label = k20X;
1053 	bi.width = 160.0f;
1054 	bi.height = 24.0f;
1055 	bi.topleft.Set(17.0f, 31.0f);
1056 	ati.SetButtonInfo(0, bi);
1057 	bi.label = k20X;
1058 	bi.width = 160.0f;
1059 	bi.height = 24.0f;
1060 	bi.topleft.Set(186.0f, 31.0f);
1061 	ati.SetButtonInfo(1, bi);
1062 	bi.label = k20X;
1063 	bi.width = 160.0f;
1064 	bi.height = 30.0f;
1065 	bi.topleft.Set(352.0f, 28.0f);
1066 	ati.SetButtonInfo(2, bi);
1067 
1068 	ati.SetButtonWidthMode(B_WIDTH_AS_USUAL);
1069 	ati.SetButtonSpacingMode(B_EVEN_SPACING);
1070 	ati.SetAlertType(B_EMPTY_ALERT);
1071 
1072 	ati.GuiInfoTest();
1073 }
1074 
1075