static void test_widen(void) { GpStatus status; GpPath *path; GpPen *pen; GpMatrix *m; INT count=-1; status = GdipCreatePath(FillModeAlternate, &path); expect(Ok, status); status = GdipCreatePen1(0xffffffff, 10.0, UnitPixel, &pen); expect(Ok, status); status = GdipCreateMatrix(&m); expect(Ok, status); /* NULL arguments */ status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); expect(Ok, status); status = GdipWidenPath(NULL, NULL, NULL, 0.0); expect(InvalidParameter, status); status = GdipWidenPath(path, pen, m, 0.0); expect(Ok, status); status = GdipWidenPath(path, pen, NULL, 1.0); expect(Ok, status); status = GdipWidenPath(path, NULL, m, 1.0); expect(InvalidParameter, status); status = GdipWidenPath(NULL, pen, m, 1.0); expect(InvalidParameter, status); /* widen empty path */ status = GdipResetPath(path); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(OutOfMemory, status); /* horizontal line */ status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); /* horizontal 2x stretch */ status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 2.5, 10.0, 25.0, 10.0); expect(Ok, status); status = GdipScaleMatrix(m, 2.0, 1.0, MatrixOrderAppend); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); /* vertical 2x stretch */ status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 5.0, 50.0, 5.0); expect(Ok, status); status = GdipScaleMatrix(m, 0.5, 2.0, MatrixOrderAppend); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend); expect(Ok, status); /* dashed line */ status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 5.0, 50.0, 5.0); expect(Ok, status); status = GdipSetPenDashStyle(pen, DashStyleDash); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_dash_path, sizeof(widenline_dash_path)/sizeof(path_test_t), FALSE); status = GdipSetPenDashStyle(pen, DashStyleSolid); expect(Ok, status); /* pen width in UnitWorld */ GdipDeletePen(pen); status = GdipCreatePen1(0xffffffff, 10.0, UnitWorld, &pen); expect(Ok, status); status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); /* horizontal 2x stretch */ status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 2.5, 10.0, 25.0, 10.0); expect(Ok, status); status = GdipScaleMatrix(m, 2.0, 1.0, MatrixOrderAppend); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); /* vertical 2x stretch */ status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 5.0, 50.0, 5.0); expect(Ok, status); status = GdipScaleMatrix(m, 0.5, 2.0, MatrixOrderAppend); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_wide_path, sizeof(widenline_wide_path)/sizeof(path_test_t), FALSE); status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend); expect(Ok, status); /* pen width in UnitInch */ GdipDeletePen(pen); status = GdipCreatePen1(0xffffffff, 10.0, UnitWorld, &pen); expect(Ok, status); status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); /* pen width = 0 pixels - native fails to widen but can draw with this pen */ GdipDeletePen(pen); status = GdipCreatePen1(0xffffffff, 0.0, UnitPixel, &pen); expect(Ok, status); status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); status = GdipGetPointCount(path, &count); expect(Ok, status); todo_wine expect(0, count); GdipDeleteMatrix(m); GdipDeletePen(pen); GdipDeletePath(path); }
static void test_widen(void) { GpStatus status; GpPath *path; GpPen *pen; GpMatrix *m; status = GdipCreatePath(FillModeAlternate, &path); expect(Ok, status); status = GdipCreatePen1(0xffffffff, 10.0, UnitPixel, &pen); expect(Ok, status); status = GdipCreateMatrix(&m); expect(Ok, status); /* NULL arguments */ status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); expect(Ok, status); status = GdipWidenPath(NULL, NULL, NULL, 0.0); expect(InvalidParameter, status); status = GdipWidenPath(path, pen, m, 0.0); expect(Ok, status); status = GdipWidenPath(path, pen, NULL, 1.0); expect(Ok, status); status = GdipWidenPath(path, NULL, m, 1.0); expect(InvalidParameter, status); status = GdipWidenPath(NULL, pen, m, 1.0); expect(InvalidParameter, status); /* widen empty path */ status = GdipResetPath(path); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(OutOfMemory, status); /* horizontal line */ status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); /* horizontal 2x stretch */ status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 2.5, 10.0, 25.0, 10.0); expect(Ok, status); status = GdipScaleMatrix(m, 2.0, 1.0, MatrixOrderAppend); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); /* vertical 2x stretch */ status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 5.0, 50.0, 5.0); expect(Ok, status); status = GdipScaleMatrix(m, 0.5, 2.0, MatrixOrderAppend); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend); expect(Ok, status); /* pen width in UnitWorld */ GdipDeletePen(pen); status = GdipCreatePen1(0xffffffff, 10.0, UnitWorld, &pen); expect(Ok, status); status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); /* horizontal 2x stretch */ status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 2.5, 10.0, 25.0, 10.0); expect(Ok, status); status = GdipScaleMatrix(m, 2.0, 1.0, MatrixOrderAppend); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); /* vertical 2x stretch */ status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 5.0, 50.0, 5.0); expect(Ok, status); status = GdipScaleMatrix(m, 0.5, 2.0, MatrixOrderAppend); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_wide_path, sizeof(widenline_wide_path)/sizeof(path_test_t), FALSE); status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend); expect(Ok, status); /* pen width in UnitInch */ GdipDeletePen(pen); status = GdipCreatePen1(0xffffffff, 10.0, UnitWorld, &pen); expect(Ok, status); status = GdipResetPath(path); expect(Ok, status); status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0); expect(Ok, status); status = GdipWidenPath(path, pen, m, 1.0); expect(Ok, status); ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE); GdipDeleteMatrix(m); GdipDeletePen(pen); GdipDeletePath(path); }