Example #1
0
    }
    $error = '';
    if (isset($alpha)) {
        $result = $p->SetRGBColor($arg, $alpha);
    } else {
        $result = $p->SetRGBColor($arg);
    }
    if (expect_equal($expected, $result, $title, $error)) {
        $n_pass++;
    } else {
        $n_fail++;
        echo "{$error}\n";
    }
}
# ===== Test Cases =====
test_init();
# ===========================================================
if ($test_verbose) {
    echo "Testing base SetRGBColor forms...\n";
}
# These duplicate tests in u.colors but with a 4th parameter (alpha) = 0
# in the return value.
test('SetRGBColor empty string', array(0, 0, 0, 0), $p, '');
test('SetRGBColor #rrggbb black', array(0, 0, 0, 0), $p, '#000000');
test('SetRGBColor #rrggbb white', array(255, 255, 255, 0), $p, '#ffffff');
test('SetRGBColor #rrggbb white upper case', array(255, 255, 255, 0), $p, '#FFFFFF');
test('SetRGBColor array', array(20, 30, 40, 0), $p, array(20, 30, 40));
test('SetRGBColor black array', array(0, 0, 0, 0), $p, array(0, 0, 0));
# Named colors from the RGB array:
test('SetRGBColor by name', array(0, 0, 255, 0), $p, 'blue');
test('SetRGBColor by name', array(250, 128, 114, 0), $p, 'salmon');
function test_is_https($k, $v, $should_be_https)
{
    global $host, $path;
    global $https_key, $https_value;
    test_init("off", $host, $path, null, true);
    unset($_SERVER[$https_key]);
    $_SERVER[$k] = $v;
    $is_https = is_https();
    $pass = $is_https === $should_be_https ? true : false;
    pass_fail($pass);
    echo "\t\t\tHTTPS ({$k}) is set to " . ($is_https ? "on" : "off");
    if (!$pass) {
        echo "\n\t\t\tand it should be " . ($should_be_https ? "on" : "off");
    }
    echo "\n\n";
}