1 static char help[] = "Tests repeatedly setting a window type.\n";
2
3 #include <petscsys.h>
4 #include <petscdraw.h>
5
main(int argc,char ** argv)6 int main(int argc, char **argv)
7 {
8 PetscDraw draw;
9 int x = 0, y = 0, width = 300, height = 300;
10
11 PetscFunctionBeginUser;
12 PetscCall(PetscInitialize(&argc, &argv, NULL, help));
13 PetscCall(PetscDrawCreate(PETSC_COMM_WORLD, 0, "Title", x, y, width, height, &draw));
14 #if defined(PETSC_HAVE_X)
15 PetscCall(PetscDrawSetType(draw, "x"));
16 PetscCall(PetscDrawSetType(draw, "null"));
17 PetscCall(PetscDrawSetType(draw, "x"));
18 #else
19 PetscCall(PetscDrawSetType(draw, "null"));
20 #endif
21 PetscCall(PetscDrawSetFromOptions(draw));
22 PetscCall(PetscDrawSetViewPort(draw, .25, .25, .75, .75));
23 PetscCall(PetscDrawClear(draw));
24 PetscCall(PetscDrawLine(draw, 0.0, 0.0, 1.0, 1.0, PETSC_DRAW_BLACK));
25 PetscCall(PetscDrawString(draw, .2, .2, PETSC_DRAW_RED, "Some Text"));
26 PetscCall(PetscDrawStringSetSize(draw, .5, .5));
27 PetscCall(PetscDrawString(draw, .2, .2, PETSC_DRAW_BLUE, "Some Text"));
28 PetscCall(PetscDrawFlush(draw));
29 PetscCall(PetscSleep(2));
30 PetscCall(PetscDrawResizeWindow(draw, 600, 600));
31 PetscCall(PetscDrawClear(draw));
32 PetscCall(PetscSleep(2));
33 PetscCall(PetscDrawLine(draw, 0.0, 1.0, 1.0, 0.0, PETSC_DRAW_BLUE));
34 PetscCall(PetscDrawFlush(draw));
35 PetscCall(PetscSleep(2));
36 PetscCall(PetscDrawDestroy(&draw));
37 PetscCall(PetscFinalize());
38 return 0;
39 }
40
41 /*TEST
42
43 build:
44 requires: x
45
46 test:
47 output_file: output/empty.out
48
49 TEST*/
50