function test($msg, $angle, $dist, $expect_xoff, $expect_yoff, $expected_align) { global $test_debug, $tests, $fails, $error; $failed = False; $tests++; $p = new PHPlot_test(); if (isset($angle)) { $p->data_value_label_angle = $angle; } if (isset($dist)) { $p->data_value_label_distance = $dist; } // 'plotin' arg always enables labels. $p->test_CheckDataValueLabels('plotin', $x_adj, $y_adj, $h_align, $v_align); $align = $h_align . $v_align; if ($test_debug) { echo "CheckDataValueLabels(angle=" . (isset($angle) ? $angle : "UNSET") . ', dist=' . (isset($dist) ? $dist : "UNSET") . ")\n " . "offset=({$x_adj}, {$y_adj}) alignment={$align}\n"; } if (!expect_equal($expected_align, $align, "{$msg} alignment", $error)) { $failed = True; } // Offsets need to be checked within a fuzz factor. Use 1 since the // function actually returns an integer number of pixels. if (!expect_float($expect_xoff, $x_adj, 1, "{$msg} x-offset", $error) || !expect_float($expect_yoff, $y_adj, 1, "{$msg} y-offset", $error)) { $failed = True; } if ($failed) { $fails++; } }