Added dibtest - only 1BPP test for now
authorJason Filby <jason.filby@gmail.com>
Sun, 22 Sep 2002 20:09:01 +0000 (20:09 +0000)
committerJason Filby <jason.filby@gmail.com>
Sun, 22 Sep 2002 20:09:01 +0000 (20:09 +0000)
svn path=/trunk/; revision=3533

reactos/Makefile
reactos/apps/tests/dibtest/dibtest.c [new file with mode: 0644]
reactos/apps/tests/dibtest/makefile [new file with mode: 0644]

index b4804f0..83e3103 100644 (file)
@@ -86,7 +86,7 @@ SYS_SVC = rpcss eventlog
 # pteb regtest sectest shm simple thread vmtest winhello
 TEST_APPS = alive apc args atomtest bench consume count dump_shared_data \
             event file gditest hello isotest lpc mstest mutex nptest \
-            pteb regtest sectest shm simple thread tokentest vmtest winhello
+            pteb regtest sectest shm simple thread tokentest vmtest winhello dibtest
 
 # Test applications
 # cabman cat net objdir partinfo pice ps stats
diff --git a/reactos/apps/tests/dibtest/dibtest.c b/reactos/apps/tests/dibtest/dibtest.c
new file mode 100644 (file)
index 0000000..2fd4296
--- /dev/null
@@ -0,0 +1,81 @@
+#include <windows.h>
+
+extern BOOL STDCALL GdiDllInitialize(HANDLE hInstance, DWORD Event, LPVOID Reserved);
+
+void __stdcall Test1BPP (HDC Desktop)
+{
+  HDC TestDC;
+  HPEN WhitePen;
+  HBITMAP DIB1;
+  BITMAPINFOHEADER BitInf;
+  PBITMAPINFO BitPalInf;
+  DWORD bmiSize = sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 2;
+
+  // Create a 1BPP DIB
+  BitPalInf = (PBITMAPINFO)malloc(bmiSize);
+  BitInf.biSize = sizeof(BITMAPINFOHEADER);
+  BitInf.biWidth = 50;
+  BitInf.biHeight = -50; // it's top down (since BI_RGB is used, the sign is operative of direction)
+  BitInf.biPlanes = 1;
+  BitInf.biBitCount = 1;
+  BitInf.biCompression = BI_RGB;
+  BitInf.biSizeImage = 0;
+  BitInf.biXPelsPerMeter = 0;
+  BitInf.biYPelsPerMeter = 0;
+  BitInf.biClrUsed = 0;
+  BitInf.biClrImportant = 0;
+  BitPalInf->bmiHeader = BitInf;
+  BitPalInf->bmiColors[1].rgbBlue = 255;
+  BitPalInf->bmiColors[1].rgbGreen = 255;
+  BitPalInf->bmiColors[1].rgbRed = 255;
+  BitPalInf->bmiColors[1].rgbReserved = 255;
+  BitPalInf->bmiColors[0].rgbBlue = 0;
+  BitPalInf->bmiColors[0].rgbGreen = 0;
+  BitPalInf->bmiColors[0].rgbRed = 0;
+  BitPalInf->bmiColors[0].rgbReserved = 0;
+
+  DIB1 = (HBITMAP) CreateDIBSection(NULL, BitPalInf, DIB_RGB_COLORS, NULL, NULL, 0);
+  TestDC = CreateCompatibleDC(NULL);
+  SelectObject(TestDC, DIB1);
+
+  // Draw a white rectangle on the 1BPP DIB
+  WhitePen = CreatePen(PS_SOLID, 1, RGB(255, 255, 255));
+  SelectObject(TestDC, WhitePen);
+  Rectangle(TestDC, 0, 0, 40, 40);
+
+  // Blt the 1BPP DIB to the display
+  BitBlt(Desktop, 0, 0, 50, 50, TestDC, 0, 0, SRCCOPY);
+
+  free(BitPalInf);
+// Rectangle(Desktop, 50, 50, 200, 200);
+}
+
+void DIBTest(void)
+{
+  HDC  Desktop;
+
+  // Set up a DC called Desktop that accesses DISPLAY
+  Desktop = CreateDCA("DISPLAY", NULL, NULL, NULL);
+  if(Desktop == NULL) {
+       printf("Can't create desktop\n");
+    return;
+  }
+
+  // 1BPP Test
+  Test1BPP(Desktop);
+
+  Sleep(10000);
+
+  // Free up everything
+  DeleteDC(Desktop);
+}
+
+int main(int argc, char* argv[])
+{
+  printf("Entering DIBTest..\n");
+
+  GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL);
+  DIBTest();
+
+  return 0;
+}
diff --git a/reactos/apps/tests/dibtest/makefile b/reactos/apps/tests/dibtest/makefile
new file mode 100644 (file)
index 0000000..81b72a5
--- /dev/null
@@ -0,0 +1,21 @@
+# $Id: makefile,v 1.1 2002/09/22 20:09:01 jfilby Exp $
+
+PATH_TO_TOP = ../../..
+
+TARGET_NORC = yes
+
+TARGET_TYPE = program
+
+TARGET_APPTYPE = console
+
+TARGET_NAME = dibtest
+
+TARGET_SDKLIBS = kernel32.a gdi32.a
+
+TARGET_OBJECTS = $(TARGET_NAME).o
+
+include $(PATH_TO_TOP)/rules.mak
+
+include $(TOOLS_PATH)/helper.mk
+
+# EOF