1//------------------------------------------------------------------------------
2//	SetBitsTester.cpp
3//
4//------------------------------------------------------------------------------
5
6// Standard Includes -----------------------------------------------------------
7#include <stdio.h>
8
9// System Includes -------------------------------------------------------------
10#include <Message.h>
11#include <OS.h>
12#include <Application.h>
13#include <Bitmap.h>
14#include <String.h>
15
16// Project Includes ------------------------------------------------------------
17#include <TestShell.h>
18#include <TestUtils.h>
19#include <cppunit/TestAssert.h>
20
21// Local Includes --------------------------------------------------------------
22#include "SetBitsTester.h"
23
24// Local Defines ---------------------------------------------------------------
25
26// Globals ---------------------------------------------------------------------
27
28//------------------------------------------------------------------------------
29
30struct set_bits_test_data {
31	color_space	space;
32	int32 		width;
33	int32 		height;
34	int32		offset;
35	int32		length;
36	int32		pixel_count;
37	uint8		data[256];
38};
39
40// B_RGB32, width = 3
41set_bits_test_data rgb32_test_data3_initial = {
42	B_RGB32, 3, 2,
43	8, 24, 6,
44	{
45		  0,   0,   0, 255,		  8,   8,   8, 255,		128, 128, 128, 255,
46		255, 255, 255, 255,		  0,   0, 228, 255,		  0, 102,   0, 255,
47	}
48};
49
50set_bits_test_data rgb32_test_data3a_initial = {
51	B_RGB32, 3, 2,
52	8, 24, 6,
53	{
54		  0,   0,   0,   0,		  8,   8,   8,   0,		128, 128, 128,   0,
55		255, 255, 255,   0,		  0,   0, 228,   0,		  0, 102,   0,   0,
56	}
57};
58
59set_bits_test_data rgb32_test_data3_set = {
60	B_RGB32, 3, 2,
61	0, 18, 6,
62	{
63		255, 255, 152,		 51, 102, 102,		 51, 255, 203,
64		  0, 102,  51,		203, 152, 203,		203, 203,   0,
65	}
66};
67
68set_bits_test_data rgb32_test_data3p_set = {
69	B_RGB32, 3, 1,
70	0, 9, 3,
71	{
72		 51, 255, 203,		0, 102,  51,		203, 152, 203,
73	}
74};
75
76set_bits_test_data rgb32_test_data3_final = {
77	B_RGB32, 3, 2,
78	0, 24, 6,
79	{
80		152, 255, 255, 255,		102, 102,  51, 255,		203, 255,  51, 255,
81		 51, 102,   0, 255,		203, 152, 203, 255,		  0, 203, 203, 255,
82	}
83};
84
85set_bits_test_data rgb32_test_data3a_final = {
86	B_RGB32, 3, 2,
87	0, 24, 6,
88	{
89		152, 255, 255,   0,		102, 102,  51,   0,		203, 255,  51,   0,
90		 51, 102,   0,   0,		203, 152, 203,   0,		  0, 203, 203,   0,
91	}
92};
93
94set_bits_test_data rgb32_test_data3g_final = {
95	B_RGB32, 3, 2,
96	0, 24, 6,
97	{
98		255, 255, 255, 255,		  0,   0,   0, 255,		255, 255, 255, 255,
99		  0,   0,   0, 255,		255, 255, 255, 255,		255, 255, 255, 255,
100	}
101};
102
103set_bits_test_data rgb32_test_data3p_final = {
104	B_RGB32, 3, 2,
105	0, 24, 6,
106	{
107		  0,   0,   0, 255,		  8,   8,   8, 255,		203, 255,  51, 255,
108		 51, 102,   0, 255,		203, 152, 203, 255,		  0, 102,   0, 255,
109	}
110};
111
112set_bits_test_data rgb32_test_data3ap_final = {
113	B_RGB32, 3, 2,
114	0, 24, 6,
115	{
116		  0,   0,   0,   0,		  8,   8,   8,   0,		203, 255,  51,   0,
117		 51, 102,   0,   0,		203, 152, 203,   0,		  0, 102,   0,   0,
118	}
119};
120
121// B_RGB32, width = 4
122set_bits_test_data rgb32_test_data4_initial = {
123	B_RGB32, 4, 2,
124	8, 32, 8,
125	{
126		  0,   0,   0, 255,		  8,   8,   8, 255,		128, 128, 128, 255,
127		255, 255, 255, 255,		  0,   0, 228, 255,		  0, 102,   0, 255,
128		255,   0,   0, 255,		152, 102,   0, 255,
129	}
130};
131
132set_bits_test_data rgb32_test_data4a_initial = {
133	B_RGB32, 4, 2,
134	8, 32, 8,
135	{
136		  0,   0,   0,   0,		  8,   8,   8,   0,		128, 128, 128,   0,
137		255, 255, 255,   0,		  0,   0, 228,   0,		  0, 102,   0,   0,
138		255,   0,   0,   0,		152, 102,   0,   0,
139	}
140};
141
142set_bits_test_data rgb32_test_data4_set = {
143	B_RGB32, 4, 2,
144	0, 24, 8,
145	{
146		255, 255, 152,		 51, 102, 102,		 51, 255, 203,
147		  0, 102,  51,		203, 152, 203,		203, 203,   0,
148		152, 255, 203,		  0,  30,   0,
149	}
150};
151
152set_bits_test_data rgb32_test_data4p_set = rgb32_test_data3p_set;
153
154set_bits_test_data rgb32_test_data4_final = {
155	B_RGB32, 4, 2,
156	0, 32, 8,
157	{
158		152, 255, 255, 255,		102, 102,  51, 255,		203, 255,  51, 255,
159		 51, 102,   0, 255,		203, 152, 203, 255,		  0, 203, 203, 255,
160		203, 255, 152, 255,		  0,  30,   0, 255,
161	}
162};
163
164set_bits_test_data rgb32_test_data4a_final = {
165	B_RGB32, 4, 2,
166	0, 32, 8,
167	{
168		152, 255, 255,   0,		102, 102,  51,   0,		203, 255,  51,   0,
169		 51, 102,   0,   0,		203, 152, 203,   0,		  0, 203, 203,   0,
170		203, 255, 152,   0,		  0,  30,   0,   0,
171	}
172};
173
174set_bits_test_data rgb32_test_data4g_final = {
175	B_RGB32, 4, 2,
176	0, 32, 8,
177	{
178		255, 255, 255, 255,		  0,   0,   0, 255,		255, 255, 255, 255,
179		  0,   0,   0, 255,		255, 255, 255, 255,		255, 255, 255, 255,
180		255, 255, 255, 255,		  0,   0,   0, 255,
181	}
182};
183
184set_bits_test_data rgb32_test_data4p_final = {
185	B_RGB32, 4, 2,
186	0, 32, 8,
187	{
188		  0,   0,   0, 255,		  8,   8,   8, 255,		203, 255,  51, 255,
189		 51, 102,   0, 255,		203, 152, 203, 255,		  0, 102,   0, 255,
190		255,   0,   0, 255,		152, 102,   0, 255,
191	}
192};
193
194set_bits_test_data rgb32_test_data4ap_final = {
195	B_RGB32, 4, 2,
196	0, 32, 8,
197	{
198		  0,   0,   0,   0,		  8,   8,   8,   0,		203, 255,  51,   0,
199		 51, 102,   0,   0,		203, 152, 203,   0,		  0, 102,   0,   0,
200		255,   0,   0,   0,		152, 102,   0,   0,
201	}
202};
203
204// B_CMAP8, width = 3
205set_bits_test_data cmap8_test_data3_initial = {
206	B_CMAP8, 3, 2,
207	2, 8, 6,
208	{
209		  0,   1,  16,   0, 255,  43, 159,   0,
210	}
211};
212
213set_bits_test_data cmap8_test_data3_set = {
214	B_CMAP8, 3, 2,
215	0, 8, 6,
216	{
217		253, 181,  83,   0, 158, 129, 101,   0,
218	}
219};
220
221set_bits_test_data cmap8_test_data3a_set = {
222	B_CMAP8, 3, 2,
223	0, 6, 6,
224	{
225		253, 181,  83, 158, 129, 101,
226	}
227};
228
229set_bits_test_data cmap8_test_data3p_set = {
230	B_CMAP8, 3, 1,
231	0, 4, 3,
232	{
233		 83,   0, 158, 129,
234	}
235};
236
237set_bits_test_data cmap8_test_data3ap_set = {
238	B_CMAP8, 3, 1,
239	0, 3, 3,
240	{
241		 83, 158, 129,
242	}
243};
244
245set_bits_test_data &cmap8_test_data3_final = cmap8_test_data3_set;
246
247set_bits_test_data cmap8_test_data3g_final = {
248	B_CMAP8, 3, 2,
249	0, 8, 6,
250	{
251		 63,   0,  63,   0,   0,  63,  63,   0,
252	}
253};
254
255set_bits_test_data cmap8_test_data3p_final = {
256	B_CMAP8, 3, 2,
257	0, 8, 6,
258	{
259		  0,   1,  83,   0, 158, 129, 159,   0,
260	}
261};
262
263// B_CMAP8, width = 4
264set_bits_test_data cmap8_test_data4_initial = {
265	B_CMAP8, 4, 2,
266	2, 8, 8,
267	{
268		  0,   1,  16, 255,  43, 159,  32, 126
269	}
270};
271
272set_bits_test_data cmap8_test_data4_set = {
273	B_CMAP8, 4, 2,
274	0, 8, 8,
275	{
276		253, 181,  83, 158, 129, 101,  71,  61
277	}
278};
279
280set_bits_test_data cmap8_test_data4p_set = {
281	B_CMAP8, 4, 2,
282	0, 3, 3,
283	{
284		 83, 158, 129,
285	}
286};
287
288set_bits_test_data &cmap8_test_data4_final = cmap8_test_data4_set;
289
290set_bits_test_data cmap8_test_data4g_final = {
291	B_CMAP8, 4, 2,
292	0, 8, 8,
293	{
294		 63,   0,  63,   0,  63,  63,  63,   0
295	}
296};
297
298set_bits_test_data cmap8_test_data4p_final = {
299	B_CMAP8, 4, 2,
300	2, 8, 8,
301	{
302		  0,   1,  83, 158, 129, 159,  32, 126
303	}
304};
305
306// B_RGB32_BIG
307set_bits_test_data rgb32_big_test_data4_initial = {
308	B_RGB32_BIG, 4, 2,
309	0, 32, 8,
310	{
311		  0,   0,   0, 255,		  8,   8,   8, 255,		128, 128, 128, 255,
312		255, 255, 255, 255,		228,   0,   0, 255,		  0, 102,   0, 255,
313		  0,   0, 255, 255,		  0, 102, 152, 255,
314	}
315};
316
317set_bits_test_data rgb32_big_test_data4_set = {
318	B_RGB32_BIG, 4, 2,
319	0, 32, 8,
320	{
321		255, 255, 152, 255,		 51, 102, 102, 255,		 51, 255, 203, 255,
322		  0, 102,  51, 255,		203, 152, 203, 255,		203, 203,   0, 255,
323		152, 255, 203, 255,		  0,  30,   0, 255,
324	}
325};
326
327set_bits_test_data rgb32_big_test_data4_final = {
328	B_RGB32_BIG, 4, 2,
329	0, 32, 8,
330	{
331		255, 255, 152,   0,		 51, 102, 102,   0,		 51, 255, 203,   0,
332		  0, 102,  51,   0,		203, 152, 203,   0,		203, 203,   0,   0,
333		152, 255, 203,   0,		  0,  30,   0,   0,
334	}
335};
336
337// B_GRAY1, width = 3
338set_bits_test_data gray1_test_data3_initial = {
339	B_GRAY1, 3, 2,
340	0, 8, 6,
341	{
342		0x20, 0x00, 0x00, 0x00,	// 001
343		0x80, 0x00, 0x00, 0x00,	// 100
344	}
345};
346
347set_bits_test_data gray1_test_data3_set = {
348	B_GRAY1, 3, 2,
349	0, 8, 6,
350	{
351		0xa0, 0x00, 0x00, 0x00,	// 101
352		0x60, 0x00, 0x00, 0x00,	// 011
353	}
354};
355
356set_bits_test_data &gray1_test_data3_final = gray1_test_data3_set;
357
358// B_GRAY1, width = 4
359set_bits_test_data gray1_test_data4_initial = {
360	B_GRAY1, 4, 2,
361	0, 8, 8,
362	{
363		0x30, 0x00, 0x00, 0x00,	// 0011
364		0x00, 0x00, 0x00, 0x00,	// 0000
365	}
366};
367
368set_bits_test_data gray1_test_data4_set = {
369	B_GRAY1, 4, 2,
370	0, 8, 8,
371	{
372		0xa0, 0x00, 0x00, 0x00,	// 1010
373		0xe0, 0x00, 0x00, 0x00,	// 1110
374	}
375};
376
377set_bits_test_data &gray1_test_data4_final = gray1_test_data4_set;
378
379#if 0
380// dump_bitmap
381static
382void
383dump_bitmap(const BBitmap *bitmap)
384{
385	BRect bounds = bitmap->Bounds();
386	int32 width = bounds.IntegerWidth() + 1;
387	int32 height = bounds.IntegerHeight() + 1;
388	printf("BBitmap: %ldx%ld, %x\n", width, height, bitmap->ColorSpace());
389	int32 bpr = bitmap->BytesPerRow();
390	const uint8 *bits = (const uint8*)bitmap->Bits();
391	for (int32 y = 0; y < height; y++) {
392		const uint8 *row = bits + y * bpr;
393		for (int32 i = 0; i < bpr; i++)
394			printf("%02x ", row[i]);
395		printf("\n");
396	}
397}
398#endif
399
400// test_set_bits
401static
402void
403test_set_bits(const set_bits_test_data &initialData,
404			  const set_bits_test_data &setData,
405			  const set_bits_test_data &finalData)
406{
407	BRect bounds(0, 0, initialData.width - 1, initialData.height - 1);
408	BBitmap bitmap(bounds, initialData.space);
409	CHK(bitmap.InitCheck() == B_OK);
410	CHK(bitmap.Bounds() == bounds);
411	CHK(bitmap.BitsLength() == initialData.length);
412	memcpy(bitmap.Bits(), initialData.data, initialData.length);
413//dump_bitmap(&bitmap);
414//printf("bitmap.SetBits(%p, %ld, %ld, %x)\n", setData.data, setData.length, 0L,
415//setData.space);
416	bitmap.SetBits(setData.data, setData.length, 0, setData.space);
417//dump_bitmap(&bitmap);
418	CHK(memcmp(bitmap.Bits(), finalData.data, finalData.length) == 0);
419}
420
421// test_set_bits2
422static
423void
424test_set_bits2(const set_bits_test_data &initialData,
425			   const set_bits_test_data &setData,
426			   const set_bits_test_data &finalData)
427{
428	BRect bounds(0, 0, initialData.width - 1, initialData.height - 1);
429	BBitmap bitmap(bounds, initialData.space);
430	CHK(bitmap.InitCheck() == B_OK);
431	CHK(bitmap.Bounds() == bounds);
432	CHK(bitmap.BitsLength() == initialData.length);
433	memcpy(bitmap.Bits(), initialData.data, initialData.length);
434//dump_bitmap(&bitmap);
435//printf("bitmap.SetBits(%p, %ld, %ld, %x)\n", setData.data, setData.length,
436//initialData.offset, setData.space);
437	bitmap.SetBits(setData.data, setData.length, initialData.offset,
438				   setData.space);
439//dump_bitmap(&bitmap);
440	CHK(memcmp(bitmap.Bits(), finalData.data, finalData.length) == 0);
441}
442
443// test for Haiku only API
444#ifndef TEST_R5
445
446// test_import_bits
447static
448void
449test_import_bits(const set_bits_test_data &initialData,
450				 const set_bits_test_data &setData,
451				 const set_bits_test_data &finalData)
452{
453	// init bitmap 1
454	BRect bounds(0, 0, initialData.width - 1, initialData.height - 1);
455	BBitmap bitmap(bounds, initialData.space);
456	CHK(bitmap.InitCheck() == B_OK);
457	CHK(bitmap.Bounds() == bounds);
458	CHK(bitmap.BitsLength() == initialData.length);
459	memcpy(bitmap.Bits(), initialData.data, initialData.length);
460	// init bitmap 2
461	BRect bounds2(0, 0, setData.width - 1, setData.height - 1);
462	BBitmap bitmap2(bounds2, setData.space);
463	CHK(bitmap2.InitCheck() == B_OK);
464	CHK(bitmap2.Bounds() == bounds2);
465	CHK(bitmap2.BitsLength() == setData.length);
466	memcpy(bitmap2.Bits(), setData.data, setData.length);
467	// import bits
468	CHK(bounds == bounds2);
469	CHK(initialData.length == finalData.length);
470//dump_bitmap(&bitmap);
471//printf("bitmap.ImportBits(): (%ld, %ld, %x) -> (%ld, %ld, %x)\n",
472//bounds.IntegerWidth() + 1, bounds.IntegerHeight() + 1, initialData.space,
473//bounds2.IntegerWidth() + 1, bounds2.IntegerHeight() + 1, setData.space);
474	CHK(bitmap.ImportBits(&bitmap2) == B_OK);
475//dump_bitmap(&bitmap);
476	CHK(memcmp(bitmap.Bits(), finalData.data, finalData.length) == 0);
477}
478
479#endif	// test for Haiku only API
480
481/*
482	void SetBits(const void *data, int32 length, int32 offset,
483				 color_space colorSpace)
484	@case 1			overwrite complete bitmap data, offset = 0,
485					different color spaces, no row padding
486	@results		Bitmap should contain the correct data.
487 */
488void SetBitsTester::SetBits1()
489{
490	BApplication app("application/x-vnd.obos.bitmap-setbits-test");
491#ifdef TEST_R5
492	test_set_bits(rgb32_test_data3_initial, rgb32_test_data3_set,
493				  rgb32_test_data3a_final);
494	test_set_bits(rgb32_test_data4_initial, rgb32_test_data4_set,
495				  rgb32_test_data4a_final);
496	test_set_bits(cmap8_test_data4_initial, cmap8_test_data4_set,
497				  cmap8_test_data4_final);
498
499	test_set_bits(rgb32_test_data4a_initial, cmap8_test_data4_set,
500				  rgb32_test_data4_final);
501	test_set_bits(cmap8_test_data4_initial, rgb32_test_data4_set,
502				  cmap8_test_data4_final);
503#else
504	test_set_bits(rgb32_test_data3_initial, rgb32_test_data3_set,
505				  rgb32_test_data3_final);
506	test_set_bits(rgb32_test_data4_initial, rgb32_test_data4_set,
507				  rgb32_test_data4_final);
508	test_set_bits(cmap8_test_data4_initial, cmap8_test_data4_set,
509				  cmap8_test_data4_final);
510
511	test_set_bits(rgb32_test_data4_initial, cmap8_test_data4_set,
512				  rgb32_test_data4_final);
513	test_set_bits(cmap8_test_data4_initial, rgb32_test_data4_set,
514				  cmap8_test_data4_final);
515#endif
516}
517
518/*
519	void SetBits(const void *data, int32 length, int32 offset,
520				 color_space colorSpace)
521	@case 2			overwrite complete bitmap data, offset = 0,
522					different color spaces, row padding
523	@results		Bitmap should contain the correct data.
524 */
525void SetBitsTester::SetBits2()
526{
527	BApplication app("application/x-vnd.obos.bitmap-setbits-test");
528	test_set_bits(cmap8_test_data3_initial, cmap8_test_data3_set,
529				  cmap8_test_data3_final);
530	test_set_bits(gray1_test_data3_initial, gray1_test_data3_set,
531				  gray1_test_data3_final);
532	test_set_bits(gray1_test_data4_initial, gray1_test_data4_set,
533				  gray1_test_data4_final);
534
535// ignores source row padding
536	test_set_bits(rgb32_test_data3a_initial, cmap8_test_data3a_set,
537				  rgb32_test_data3_final);
538#ifndef TEST_R5
539// R5: broken: no effect
540	test_set_bits(rgb32_test_data3a_initial, gray1_test_data3_set,
541				  rgb32_test_data3g_final);
542	test_set_bits(rgb32_test_data4a_initial, gray1_test_data4_set,
543				  rgb32_test_data4g_final);
544// R5: broken: ignores target bitmap row padding
545	test_set_bits(cmap8_test_data3_initial, rgb32_test_data3_set,
546				  cmap8_test_data3_final);
547// R5: broken: simply copies the data
548	test_set_bits(cmap8_test_data3_initial, gray1_test_data3_set,
549				  cmap8_test_data3g_final);
550	test_set_bits(cmap8_test_data4_initial, gray1_test_data4_set,
551				  cmap8_test_data4g_final);
552#endif
553}
554
555/*
556	void SetBits(const void *data, int32 length, int32 offset,
557				 color_space colorSpace)
558	@case 3			overwrite bitmap data partially, offset = 0,
559					different color spaces, no row padding
560	@results		Bitmap should contain the correct data.
561 */
562void SetBitsTester::SetBits3()
563{
564	BApplication app("application/x-vnd.obos.bitmap-setbits-test");
565#ifdef TEST_R5
566	test_set_bits2(rgb32_test_data3a_initial, rgb32_test_data3p_set,
567				   rgb32_test_data3ap_final);
568	test_set_bits2(rgb32_test_data4a_initial, rgb32_test_data4p_set,
569				   rgb32_test_data4ap_final);
570	test_set_bits2(cmap8_test_data4_initial, cmap8_test_data4p_set,
571				   cmap8_test_data4p_final);
572#else
573	test_set_bits2(rgb32_test_data3_initial, rgb32_test_data3p_set,
574				   rgb32_test_data3p_final);
575	test_set_bits2(rgb32_test_data4_initial, rgb32_test_data4p_set,
576				   rgb32_test_data4p_final);
577	test_set_bits2(cmap8_test_data4_initial, cmap8_test_data4p_set,
578				   cmap8_test_data4p_final);
579#endif
580
581	test_set_bits2(rgb32_test_data4_initial, cmap8_test_data4p_set,
582				   rgb32_test_data4p_final);
583	test_set_bits2(cmap8_test_data4_initial, rgb32_test_data4p_set,
584				   cmap8_test_data4p_final);
585}
586
587/*
588	void SetBits(const void *data, int32 length, int32 offset,
589				 color_space colorSpace)
590	@case 4			overwrite bitmap data partially, offset = 0,
591					different color spaces, row padding
592	@results		Bitmap should contain the correct data.
593 */
594void SetBitsTester::SetBits4()
595{
596	BApplication app("application/x-vnd.obos.bitmap-setbits-test");
597	test_set_bits2(cmap8_test_data3_initial, cmap8_test_data3p_set,
598				   cmap8_test_data3p_final);
599
600	test_set_bits2(rgb32_test_data3_initial, cmap8_test_data3ap_set,
601				   rgb32_test_data3p_final);
602// R5: broken: ignores target bitmap row padding
603#ifndef TEST_R5
604	test_set_bits2(cmap8_test_data3_initial, rgb32_test_data3p_set,
605				   cmap8_test_data3p_final);
606#endif
607}
608
609// Haiku only API
610#ifndef TEST_R5
611
612/*
613	status_t ImportBits(const BBitmap *bitmap)
614	@case 1			NULL bitmap
615	@results		Should return B_BAD_VALUE.
616 */
617void SetBitsTester::ImportBitsA1()
618{
619	BApplication app("application/x-vnd.obos.bitmap-setbits-test");
620	BBitmap bitmap(BRect(0, 0, 9, 9), B_RGB32);
621	CHK(bitmap.ImportBits(NULL) == B_BAD_VALUE);
622}
623
624/*
625	status_t ImportBits(const BBitmap *bitmap)
626	@case 2			bitmap with different Bounds()
627	@results		Should return B_BAD_VALUE.
628 */
629void SetBitsTester::ImportBitsA2()
630{
631	BApplication app("application/x-vnd.obos.bitmap-setbits-test");
632	BBitmap bitmap(BRect(0, 0, 9, 9), B_RGB32);
633	BBitmap bitmap2(BRect(0, 0, 9, 10), B_RGB32);
634	CHK(bitmap.ImportBits(&bitmap2) == B_BAD_VALUE);
635}
636
637/*
638	status_t ImportBits(const BBitmap *bitmap)
639	@case 3			this and bitmap are properly initialized and have the
640					same bounds, different color spaces
641	@results		Should set the data and return B_OK.
642 */
643void SetBitsTester::ImportBitsA3()
644{
645	BApplication app("application/x-vnd.obos.bitmap-setbits-test");
646	// B_RGB32
647	test_import_bits(rgb32_test_data3_initial, rgb32_test_data3_final,
648					 rgb32_test_data3_final);
649	test_import_bits(rgb32_test_data3_initial, cmap8_test_data3_final,
650					 rgb32_test_data3_final);
651	test_import_bits(rgb32_test_data3_initial, gray1_test_data3_final,
652					 rgb32_test_data3g_final);
653	test_import_bits(rgb32_test_data4_initial, rgb32_test_data4_final,
654					 rgb32_test_data4_final);
655	test_import_bits(rgb32_test_data4_initial, cmap8_test_data4_final,
656					 rgb32_test_data4_final);
657	test_import_bits(rgb32_test_data4_initial, gray1_test_data4_final,
658					 rgb32_test_data4g_final);
659	// B_CMAP8
660	test_import_bits(cmap8_test_data3_initial, rgb32_test_data3_final,
661					 cmap8_test_data3_final);
662	test_import_bits(cmap8_test_data3_initial, cmap8_test_data3_final,
663					 cmap8_test_data3_final);
664	test_import_bits(cmap8_test_data3_initial, gray1_test_data3_final,
665					 cmap8_test_data3g_final);
666	test_import_bits(cmap8_test_data4_initial, rgb32_test_data4_final,
667					 cmap8_test_data4_final);
668	test_import_bits(cmap8_test_data4_initial, cmap8_test_data4_final,
669					 cmap8_test_data4_final);
670	test_import_bits(cmap8_test_data4_initial, gray1_test_data4_final,
671					 cmap8_test_data4g_final);
672	// B_GRAY1
673	test_import_bits(gray1_test_data3_initial, rgb32_test_data3_final,
674					 gray1_test_data3_final);
675	test_import_bits(gray1_test_data3_initial, cmap8_test_data3_final,
676					 gray1_test_data3_final);
677	test_import_bits(gray1_test_data3_initial, gray1_test_data3_final,
678					 gray1_test_data3_final);
679	test_import_bits(gray1_test_data4_initial, rgb32_test_data4_final,
680					 gray1_test_data4_final);
681	test_import_bits(gray1_test_data4_initial, cmap8_test_data4_final,
682					 gray1_test_data4_final);
683	test_import_bits(gray1_test_data4_initial, gray1_test_data4_final,
684					 gray1_test_data4_final);
685}
686#endif // ifndef TEST_R5
687
688Test* SetBitsTester::Suite()
689{
690	TestSuite* SuiteOfTests = new TestSuite;
691
692	ADD_TEST4(BBitmap, SuiteOfTests, SetBitsTester, SetBits1);
693	ADD_TEST4(BBitmap, SuiteOfTests, SetBitsTester, SetBits2);
694	ADD_TEST4(BBitmap, SuiteOfTests, SetBitsTester, SetBits3);
695	ADD_TEST4(BBitmap, SuiteOfTests, SetBitsTester, SetBits4);
696
697// Haiku only API
698#ifndef TEST_R5
699	ADD_TEST4(BBitmap, SuiteOfTests, SetBitsTester, ImportBitsA1);
700	ADD_TEST4(BBitmap, SuiteOfTests, SetBitsTester, ImportBitsA2);
701	ADD_TEST4(BBitmap, SuiteOfTests, SetBitsTester, ImportBitsA3);
702#endif
703
704	return SuiteOfTests;
705}
706
707