diff options
author | Havoc Pennington <hp@pobox.com> | 2002-02-02 05:09:19 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2002-02-02 05:09:19 +0000 |
commit | 089eb7e6ded4d233ea48ceab4e9954e316a7ba76 (patch) | |
tree | 3d23b50a7855f5bf668d7d98505893e55af678c1 /src/theme-viewer.c | |
parent | add8c23c13676692a0da77ef8862feef3a5923bd (diff) | |
download | metacity-089eb7e6ded4d233ea48ceab4e9954e316a7ba76.tar.gz metacity-089eb7e6ded4d233ea48ceab4e9954e316a7ba76.tar.bz2 |
test % operator
2002-02-02 Havoc Pennington <hp@pobox.com>
* src/theme-viewer.c: test % operator
* src/theme.c (pos_tokenize): add % to switch for operators
* src/theme.c: rework theme stuff so we have
MetaDrawOp/MetaDrawOpList instead of MetaTextureSpec/MetaShapeSpec
Diffstat (limited to 'src/theme-viewer.c')
-rw-r--r-- | src/theme-viewer.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/theme-viewer.c b/src/theme-viewer.c index 928463c..db06bf6 100644 --- a/src/theme-viewer.c +++ b/src/theme-viewer.c @@ -186,6 +186,8 @@ static const PositionExpressionTest position_expression_tests[] = { "14 - 10", 14, 24, NO_ERROR }, { { 10, 20, 40, 50 }, "8 / 2", 14, 24, NO_ERROR }, + { { 10, 20, 40, 50 }, + "8 % 3", 12, 22, NO_ERROR }, /* Binary expressions with floats and mixed float/ints */ { { 10, 20, 40, 50 }, "7.0 / 3.5", 12, 22, NO_ERROR }, @@ -294,6 +296,10 @@ static const PositionExpressionTest position_expression_tests[] = { { { 10, 20, 40, 50 }, "- width", 0, 0, META_POSITION_EXPR_ERROR_FAILED }, { { 10, 20, 40, 50 }, + "5 % 1.0", 0, 0, META_POSITION_EXPR_ERROR_MOD_ON_FLOAT }, + { { 10, 20, 40, 50 }, + "1.0 % 5", 0, 0, META_POSITION_EXPR_ERROR_MOD_ON_FLOAT }, + { { 10, 20, 40, 50 }, "! * 2", 0, 0, META_POSITION_EXPR_ERROR_BAD_CHARACTER }, { { 10, 20, 40, 50 }, " ", 0, 0, META_POSITION_EXPR_ERROR_FAILED }, @@ -313,7 +319,8 @@ static void run_position_expression_tests (void) { int i; - + MetaPositionExprEnv env; + i = 0; while (i < G_N_ELEMENTS (position_expression_tests)) { @@ -329,12 +336,16 @@ run_position_expression_tests (void) test->expr, test->expected_x, test->expected_y); err = NULL; + + env.x = test->rect.x; + env.y = test->rect.y; + env.width = test->rect.width; + env.height = test->rect.height; + env.object_width = -1; + env.object_height = -1; retval = meta_parse_position_expression (test->expr, - test->rect.x, - test->rect.y, - test->rect.width, - test->rect.height, + &env, &x, &y, &err); @@ -377,7 +388,8 @@ run_position_expression_timings (void) int iters; clock_t start; clock_t end; - + MetaPositionExprEnv env; + #define ITERATIONS 100000 start = clock (); @@ -390,12 +402,16 @@ run_position_expression_timings (void) int x, y; test = &position_expression_tests[i]; + + env.x = test->rect.x; + env.y = test->rect.y; + env.width = test->rect.width; + env.height = test->rect.height; + env.object_width = -1; + env.object_height = -1; meta_parse_position_expression (test->expr, - test->rect.x, - test->rect.y, - test->rect.width, - test->rect.height, + &env, &x, &y, NULL); ++iters; |