main() { int rtn; int ch,loop; initscr(); cbreak(); noecho(); nonl(); intrflush(stdscr, FALSE); keypad(stdscr, TRUE); rtn = shared_memory_attach(); if ( rtn < 0) { perror("Fatal error in attaching to shm:\n"); exit(1); } clear(); time_test(); printw("Current status of dst is %d\n",T->light.dst); refresh(); printw("Hit <Y> to turn on DST or <N> to turn off or <q> to exit\n"); loop=1; while (loop) { ch = getch(); ch = toupper(ch); //printw("you hit %c\n",ch); if (ch == 'Y') { T->light.dst = 1; } if (ch == 'N') { T->light.dst = 0; } if (ch == 'Q') { loop = 0; printw("Exit state of T->light.dst is %d\n",T->light.dst); refresh(); sleep(2); } printw("state of T->light.dsp %d\n",T->light.dst); refresh(); } endwin(); }
void main_loop(void) { /* printf query filters */ printf("Available XRENDER filters:\n"); { int i; XFilters *flt; flt = XRenderQueryFilters(disp, win); for (i = 0; i < flt->nfilter; i++) printf("%s\n", flt->filter[i]); } printf("Setup...\n"); /* setup */ surf_win = xrender_surf_adopt(disp, win, DefaultVisual(disp, DefaultScreen(disp)), win_w, win_h); surf_off = xrender_surf_new(disp, win, DefaultVisual(disp, DefaultScreen(disp)), 320, 320, 0); surf_img = xrender_surf_new(disp, win, DefaultVisual(disp, DefaultScreen(disp)), 100, 100, 1); populate_from_file(disp, surf_win, "tst_opaque.png"); populate_from_file(disp, surf_off, "tst_opaque.png"); populate_from_file(disp, surf_img, "tst_transparent.png"); srand(7); time_test("Test Xrender doing non-scaled Over blends", test_over_x); srand(7); time_test("Test Xrender (offscreen) doing non-scaled Over blends", test_over_off_x); srand(7); time_test("Test Xrender doing 1/2 scaled Over blends", test_over_scale_half_x); srand(7); time_test("Test Xrender (offscreen) doing 1/2 scaled Over blends", test_over_off_scale_half_x); srand(7); time_test("Test Xrender doing 2* smooth scaled Over blends", test_over_scale_double_smooth_x); srand(7); time_test("Test Xrender (offscreen) doing 2* smooth scaled Over blends", test_over_off_scale_double_smooth_x); srand(7); time_test("Test Xrender doing 2* nearest scaled Over blends", test_over_scale_double_nearest_x); srand(7); time_test("Test Xrender (offscreen) doing 2* nearest scaled Over blends", test_over_off_scale_double_nearest_x); srand(7); count = 0; time_test("Test Xrender doing general nearest scaled Over blends", test_over_scale_general_nearest_x); count = 0; time_test("Test Xrender (offscreen) doing general nearest scaled Over blends", test_over_off_scale_general_nearest_x); count = 0; time_test("Test Xrender doing general smooth scaled Over blends", test_over_scale_general_smooth_x); count = 0; time_test("Test Xrender (offscreen) doing general smooth scaled Over blends", test_over_off_scale_general_smooth_x); XSync(disp, False); }
int main(int argc,char **argv) { progname = argv[0]; int do_bugs = 0; int do_sequential = 0; int do_reverse = 0; int do_random_write_test = 0; int do_random_read_test = 0; int do_large_file = 0; int do_maxsize_test = 0; int random_repeat = 1; int do_sparse_test = 0; int do_all=0; int do_image_test =1; int ch; const char *bigdir = getenv(AFFLIB_BIGTMP); // use by default if(bigdir) tempdir = bigdir; setvbuf(stdout,0,_IONBF,0); //putenv(AFFLIB_CACHE_STATS"=1"); if(argc==1){ printf("running all tests with -a option (exception bigfile test)\n"); do_all = 1; } while ((ch = getopt(argc, argv, "b123456aBLd:h?f:e:c:TCp:rx:R:z:tn:D:S:")) != -1) { switch(ch){ case 'D': af_trace = fopen(optarg,"w");break; case 'R': readfile_test(optarg); break; case 'b': do_bugs = 1; break; case '1': do_sequential = 1; break; case '2': do_reverse = 1; break; case '3': do_random_write_test = 1; break; case '4': do_random_read_test = 1; break; case '5': do_maxsize_test = 1; break; case '6': do_sparse_test = 1; break; case 'l': random_repeat = atoi(optarg); break; case 'B': do_large_file = 1; break; case 'n': MAX_FMTS = atoi(optarg); break; case 't': time_test(); break; case 'L': opt_compression_type = AF_COMPRESSION_ALG_LZMA; break; case 'T': lzma_test(); break; case 'r': rsatest(); break; case 'a': do_all = 1; break; case 'z': zap(optarg);break; case 'd': tempdir = optarg; break; case 'f': figure(optarg); break; case 'e': opt_ext = optarg; break; case 'c': compress(optarg); break; case 'p': opt_protocol = optarg; break; case 'x': xmltest(optarg);break; case 'C': aestest(); break; case 'i': do_image_test=1;break; case 'S': split_raw_test(optarg);exit(0); case 'h': case '?': default: usage(); } } if(do_bugs || do_all) bugs_test(); if(do_sequential || do_all) sequential_test(); if(do_reverse || do_all ) reverse_test(); if(do_maxsize_test || do_all) maxsize_test(); if(do_sparse_test || do_all) sparse_test(); if(do_image_test || do_all) image_test(); for(int i=0;i<random_repeat;i++){ if(do_random_read_test || do_all) random_read_test(256*1024,rand() % 65536); if(do_random_write_test || do_all) random_write_test(); } if(do_large_file) large_file_test(); /* Now erase the files ... */ unlink("test_random.aff"); unlink("test_reverse.aff"); unlink("test_random_contents.aff"); unlink("test_sequential.aff"); unlink("bugs.aff"); unlink("test_random_contents.img"); unlink("sparse.aff"); return 0; }