Emoji: Fix the flag and emoji5 tests not working correctly.

Fixes the UN flag not being correctly compared to itself, introduced in [40837].

Replaces the bearded person check with a male fairy. Emoji 5 does not have gendered bearded people, so we needed to switch it out to use the ZWJ check for a broken render.

Props peterwilsoncc for the code and commit message.
Fixes #40858.




git-svn-id: https://develop.svn.wordpress.org/trunk@40850 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2017-05-29 03:20:11 +00:00
parent d79ef7e73e
commit 034b3f4c77
1 changed files with 7 additions and 7 deletions

View File

@ -51,7 +51,7 @@
context.clearRect( 0, 0, canvas.width, canvas.height );
// Add a zero width space between the characters, to force rendering as characters.
context.fillText( stringFromCharCode( 55356, 57331, 8203, 55356, 57096 ), 0, 0 );
context.fillText( stringFromCharCode( 55356, 56826, 8203, 55356, 56819 ), 0, 0 );
flag2 = canvas.toDataURL();
if ( flag !== flag2 ) {
@ -79,18 +79,18 @@
return flag !== flag2;
case 'emoji4':
/*
* Emoji 5 has the bushiest beards. So does WordPress!
* Emoji 5 has faries of all genders.
*
* To test for support, try to render a new emoji (bearded person: light skin tone),
* then compare it to how it would look if the browser doesn't render it correctly
* (bearded person + Fitzpatrick modifier).
* To test for support, try to render a new emoji (fairy, male), then compares
* it to how it would look if the browser doesn't render it correctly
* (fairy + male sign).
*/
context.fillText( stringFromCharCode( 55358, 56788, 55356, 57339 ), 0, 0 );
context.fillText( stringFromCharCode( 55358, 56794, 8205, 9794, 65039 ), 0, 0 );
emoji41 = canvas.toDataURL();
context.clearRect( 0, 0, canvas.width, canvas.height );
context.fillText( stringFromCharCode( 55358, 56788, 8203, 55356, 57339 ), 0, 0 );
context.fillText( stringFromCharCode( 55358, 56794, 8203, 9794, 65039 ), 0, 0 );
emoji42 = canvas.toDataURL();
return emoji41 !== emoji42;