+ ok(csbi2.srWindow.Left == ConRect.Left, "srWindow.Left = %d, expected %d\n",
+ csbi2.srWindow.Left, ConRect.Left);
+ ok(csbi2.srWindow.Top == ConRect.Top, "srWindow.Top = %d, expected %d\n",
+ csbi2.srWindow.Top, ConRect.Top);
+ ok(csbi2.srWindow.Right == ConRect.Right, "srWindow.Right = %d, expected %d\n",
+ csbi2.srWindow.Right, ConRect.Right);
+ ok(csbi2.srWindow.Bottom == ConRect.Bottom, "srWindow.Bottom = %d, expected %d\n",
+ csbi2.srWindow.Bottom, ConRect.Bottom);
+ }
+
+ /*
+ * Test 7: Test how large can the console window be, for a given
+ * screen buffer size. For that we set the console screen buffer
+ * to a really large size, hoping that its corresponding window size
+ * is larger than the computer screen. The permitted maximum window
+ * size specified in csbi.dwMaximumWindowSize should be a boundary.
+ */
+ Resolution.X = 500;
+ Resolution.Y = 500;
+ ResizeTextConsole(hConOut, &csbi, Resolution, NULL);
+ /* Be sure that csbi.dwMaximumWindowSize is strictly smaller
+ * than the console screen buffer size, for our matters... */
+ ok((csbi.dwMaximumWindowSize.X < Resolution.X) && (csbi.dwMaximumWindowSize.Y < Resolution.Y),
+ "dwMaximumWindowSize = {%d, %d} was expected to be smaller than Resolution = {%d, %d}\n",
+ csbi.dwMaximumWindowSize.X, csbi.dwMaximumWindowSize.Y, Resolution.X, Resolution.Y);
+
+ /* Now try to set first the console window to a size smaller than the maximum size */
+ ConRect.Left = ConRect.Top = 0;
+ ConRect.Right = csbi.dwMaximumWindowSize.X - 1;
+ ConRect.Bottom = csbi.dwMaximumWindowSize.Y - 1;
+ SetLastError(0xdeadbeef);
+ Success = SetConsoleWindowInfo(hConOut, TRUE, &ConRect);
+ dwLastError = GetLastError();
+ ok(Success, "Setting console wnd info should have succeeded!\n");
+ ok(dwLastError != ERROR_INVALID_PARAMETER, "GetLastError: %lu\n", dwLastError);
+
+ /* Check the new reported window size rect */
+ Success = GetConsoleScreenBufferInfo(hConOut, &csbi2);
+ ok(Success, "Getting SB info\n");
+ if (Success)
+ {
+ ok(csbi2.srWindow.Left == ConRect.Left, "srWindow.Left = %d, expected %d\n",
+ csbi2.srWindow.Left, ConRect.Left);
+ ok(csbi2.srWindow.Top == ConRect.Top, "srWindow.Top = %d, expected %d\n",
+ csbi2.srWindow.Top, ConRect.Top);
+ ok(csbi2.srWindow.Right == ConRect.Right, "srWindow.Right = %d, expected %d\n",
+ csbi2.srWindow.Right, ConRect.Right);
+ ok(csbi2.srWindow.Bottom == ConRect.Bottom, "srWindow.Bottom = %d, expected %d\n",
+ csbi2.srWindow.Bottom, ConRect.Bottom);
+ }
+
+ /* And now try to set the console window to a size larger than the maximum size.
+ * The SetConsoleWindowInfo call should fail */
+ ConRect.Left = ConRect.Top = 0;
+ ConRect.Right = csbi.dwMaximumWindowSize.X + 1;
+ ConRect.Bottom = csbi.dwMaximumWindowSize.Y + 1;
+ SetLastError(0xdeadbeef);
+ Success = SetConsoleWindowInfo(hConOut, TRUE, &ConRect);
+ dwLastError = GetLastError();
+ ok(!Success, "Setting console wnd info should have failed!\n");
+ ok(dwLastError == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
+ ERROR_INVALID_PARAMETER, dwLastError);