#/** * @package Akismet */ /* Plugin Name: Akismet Anti-spam: Spam Protection Plugin URI: https://akismet.com/ Description: Used by millions, Akismet is quite possibly the best way in the world to protect your blog from spam. Akismet Anti-spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. Version: 5.4 Requires at least: 5.8 Requires PHP: 7.2 Author: Automattic - Anti-spam Team Author URI: https://automattic.com/wordpress-plugins/ License: GPLv2 or later Text Domain: akismet */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Copyright 2005-2025 Automattic, Inc. */ // Make sure we don't expose any info if called directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 62.109.13.187 / Your IP : 216.73.216.11 [ Web Server : Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 OpenSSL/1.0.2k-fips PHP/8.2.28 System : Linux robothost.ru 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : mosrembit ( 6064) PHP Version : 8.2.28 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/phpMyAdmin/test/classes/ |
Upload File : |
<?php
/**
* Tests for PMA_Font class
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/Font.class.php';
/**
* Tests for PMA_Font class
*
* @package PhpMyAdmin-test
*/
class PMA_Font_Test extends PHPUnit_Framework_TestCase
{
/**
* Test getStringWidth with different characters.
*
* @return void
*/
function testGetStringWidth()
{
// empty string
$this->assertEquals(
0,
PMA_Font::getStringWidth("", "arial", "10")
);
// empty string
$this->assertEquals(
3,
PMA_Font::getStringWidth(" ", "arial", "10")
);
// string "a"
$this->assertEquals(
6,
PMA_Font::getStringWidth("a", "arial", "10")
);
// string "aa"
$this->assertEquals(
12,
PMA_Font::getStringWidth("aa", "arial", "10")
);
// string "i"
$this->assertEquals(
3,
PMA_Font::getStringWidth("i", "arial", "10")
);
// string "f"
$this->assertEquals(
3,
PMA_Font::getStringWidth("f", "arial", "10")
);
// string "t"
$this->assertEquals(
3,
PMA_Font::getStringWidth("t", "arial", "10")
);
// string "if"
$this->assertEquals(
5,
PMA_Font::getStringWidth("if", "arial", "10")
);
// string "it"
$this->assertEquals(
6,
PMA_Font::getStringWidth("it", "arial", "10")
);
// string "r"
$this->assertEquals(
4,
PMA_Font::getStringWidth("r", "arial", "10")
);
// string "1"
$this->assertEquals(
5,
PMA_Font::getStringWidth("1", "arial", "10")
);
// string "c"
$this->assertEquals(
5,
PMA_Font::getStringWidth("c", "arial", "10")
);
// string "F"
$this->assertEquals(
7,
PMA_Font::getStringWidth("F", "arial", "10")
);
// string "A"
$this->assertEquals(
7,
PMA_Font::getStringWidth("A", "arial", "10")
);
// string "w"
$this->assertEquals(
8,
PMA_Font::getStringWidth("w", "arial", "10")
);
// string "G"
$this->assertEquals(
8,
PMA_Font::getStringWidth("G", "arial", "10")
);
// string "m"
$this->assertEquals(
9,
PMA_Font::getStringWidth("m", "arial", "10")
);
// string "W"
$this->assertEquals(
10,
PMA_Font::getStringWidth("W", "arial", "10")
);
// string "$"
$this->assertEquals(
3,
PMA_Font::getStringWidth("$", "arial", "10")
);
}
/**
* Test getStringWidth with different fonts.
*
* @return void
*/
function testGetStringWidthFont()
{
// string "phpMyAdmin", with Arial 10
$this->assertEquals(
59,
PMA_Font::getStringWidth("phpMyAdmin", "arial", "10")
);
// string "phpMyAdmin", with No font
$this->assertEquals(
59,
PMA_Font::getStringWidth("phpMyAdmin", "", "10")
);
// string "phpMyAdmin", with Times 10
$this->assertEquals(
55,
PMA_Font::getStringWidth("phpMyAdmin", "times", "10")
);
// string "phpMyAdmin", with Broadway 10
$this->assertEquals(
73,
PMA_Font::getStringWidth("phpMyAdmin", "broadway", "10")
);
}
/**
* Test getStringWidth with different font sizes.
*
* @return void
*/
function testGetStringWidthSize()
{
// string "phpMyAdmin", with font size 0
$this->assertEquals(
0,
PMA_Font::getStringWidth("phpMyAdmin", "arial", "0")
);
// string "phpMyAdmin", with Arial 10
$this->assertEquals(
59,
PMA_Font::getStringWidth("phpMyAdmin", "arial", "10")
);
// string "phpMyAdmin", with Arial 11
$this->assertEquals(
65,
PMA_Font::getStringWidth("phpMyAdmin", "arial", "11")
);
// string "phpMyAdmin", with Arial 20
$this->assertEquals(
118,
PMA_Font::getStringWidth("phpMyAdmin", "arial", "20")
);
}
/**
* Test getStringWidth with a custom charList.
*
* @return void
*/
function testGetStringWidthCharLists()
{
// string "a", with invalid charlist (= string)
$this->assertEquals(
6,
PMA_Font::getStringWidth("a", "arial", "10", "list")
);
// string "a", with invalid charlist (= array without proper structure)
$this->assertEquals(
6,
PMA_Font::getStringWidth("a", "arial", "10", array("list"))
);
// string "a", with invalid charlist (= array without proper structure :
// modifier is missing
$this->assertEquals(
6,
PMA_Font::getStringWidth(
"a", "arial", "10",
array(array("chars" => "a"))
)
);
// string "a", with invalid charlist (= array without proper structure :
// chars is missing
$this->assertEquals(
6,
PMA_Font::getStringWidth(
"a", "arial", "10",
array(array("modifier" => 0.61))
)
);
// string "a", with invalid charlist (= array without proper structure :
// chars is not an array
$this->assertEquals(
6,
PMA_Font::getStringWidth(
"a", "arial", "10",
array(array("chars" => "a", "modifier" => 0.61))
)
);
// string "a", with valid charlist
$this->assertEquals(
7,
PMA_Font::getStringWidth(
"a", "arial", "10",
array(array("chars" => array("a"), "modifier" => 0.61))
)
);
}
}
?>