Difference between revisions of "Template:Flag/testcases"

From blackwiki
Jump to navigation Jump to search
imported>SiBr4
imported>SiBr4
(Sandbox moved to separate template Template:Flaglist)
Line 32: Line 32:
 
|row5={{flag/sandbox|Nigeria}}{{!!}}1,400,000
 
|row5={{flag/sandbox|Nigeria}}{{!!}}1,400,000
 
}}}}
 
}}}}
 
== Jun 2014 ==
 
 
=== Code comparison ===
 
Main template:
 
*Coding: {{tnull|flag|Antarctica}}
 
*Output: {{flag|Antarctica}}
 
*Wikicode output: {{#tag:syntaxhighlight|{{flag|Antarctica}}|lang=html5}}
 
 
Sandbox:
 
*Coding: {{tnull|flag/sandbox|Antarctica}}
 
*Output: {{flag/sandbox|Antarctica}}
 
*Wikicode output: {{#tag:syntaxhighlight|{{flag/sandbox|Antarctica}}|lang=html5}}
 
 
=== Standard usage ===
 
{| class="wikitable" style="width:60%"
 
|-
 
! width="10%" |
 
! width="25%" | Main template
 
! width="25%" | Sandbox
 
|-
 
! Sorted by ratio
 
|
 
*{{flag|Qatar}} (1:2.525)
 
*{{flag|Australia}} (1:2)
 
*{{flag|Paraguay}} (1:1.818)
 
*{{flag|Iran}} (1:1.75)
 
*{{flag|Palau}} (1:1.6)
 
*{{flag|China}} (1:1.5)
 
*{{flag|Brazil}} (1:1.429)
 
*{{flag|San Marino}} (1:1.333)
 
*{{flag|Niger}} (1:1.167)
 
*{{flag|Switzerland}} (1:1)
 
*{{flag|Nepal}} (1:0.82)
 
|
 
*{{flag/sandbox|Qatar}} (1:2.525)
 
*{{flag/sandbox|Australia}} (1:2)
 
*{{flag/sandbox|Paraguay}} (1:1.818)
 
*{{flag/sandbox|Iran}} (1:1.75)
 
*{{flag/sandbox|Palau}} (1:1.6)
 
*{{flag/sandbox|China}} (1:1.5)
 
*{{flag/sandbox|Brazil}} (1:1.429)
 
*{{flag/sandbox|San Marino}} (1:1.333)
 
*{{flag/sandbox|Niger}} (1:1.167)
 
*{{flag/sandbox|Switzerland}} (1:1)
 
*{{flag/sandbox|Nepal}} (1:0.82)
 
|-
 
!Random order
 
|
 
*{{flag|Paraguay}} (1:1.818)
 
*{{flag|San Marino}} (1:1.333)
 
*{{flag|Palau}} (1:1.6)
 
*{{flag|Australia}} (1:2)
 
*{{flag|Nepal}} (1:0.82)
 
*{{flag|Brazil}} (1:1.429)
 
*{{flag|Iran}} (1:1.75)
 
*{{flag|Switzerland}} (1:1)
 
*{{flag|Qatar}} (1:2.525)
 
*{{flag|China}} (1:1.5)
 
*{{flag|Niger}} (1:1.167)
 
|
 
*{{flag/sandbox|Paraguay}} (1:1.818)
 
*{{flag/sandbox|San Marino}} (1:1.333)
 
*{{flag/sandbox|Palau}} (1:1.6)
 
*{{flag/sandbox|Australia}} (1:2)
 
*{{flag/sandbox|Nepal}} (1:0.82)
 
*{{flag/sandbox|Brazil}} (1:1.429)
 
*{{flag/sandbox|Iran}} (1:1.75)
 
*{{flag/sandbox|Switzerland}} (1:1)
 
*{{flag/sandbox|Qatar}} (1:2.525)
 
*{{flag/sandbox|China}} (1:1.5)
 
*{{flag/sandbox|Niger}} (1:1.167)
 
|}
 
 
In the sandbox version, Switzerland and Nepal are misaligned because of a nonstandard default size specified within [[Template:Country data Switzerland]] and [[Template:Country data Nepal]] respectively (the width of the box around the flag icon depends on the specified size). If these data templates were changed the list of sandbox tests would look like this:
 
 
*{{flag/sandbox|Australia}}
 
*{{flag/sandbox|Nepal|size=23x15px}}
 
*{{flag/sandbox|Iran}}
 
*{{flag/sandbox|Switzerland|size=23x15px}}
 
*{{flag/sandbox|China}}
 
 
=== Inline ===
 
*Main template: Lorem ipsum {{flag|Antarctica}} dolor sit amet
 
*Sandbox: Lorem ipsum {{flag/sandbox|Antarctica}} dolor sit amet
 
 
=== Custom size ===
 
{| class="wikitable" style="width:45%"
 
|-
 
! width="5%" |
 
! width="20%" | Main template
 
! width="20%" | Sandbox
 
|-
 
! 10px
 
|
 
*{{flag|Qatar|size=10px}}
 
*{{flag|Palau|size=10px}}
 
*{{flag|Switzerland|size=10px}}
 
|
 
*{{flag/sandbox|Qatar|size=10px}}
 
*{{flag/sandbox|Palau|size=10px}}
 
*{{flag/sandbox|Switzerland|size=10px}}
 
|-
 
! x8px
 
|
 
*{{flag|Qatar|size=x8px}}
 
*{{flag|Palau|size=x8px}}
 
*{{flag|Switzerland|size=x8px}}
 
|
 
*{{flag/sandbox|Qatar|size=x8px}}
 
*{{flag/sandbox|Palau|size=x8px}}
 
*{{flag/sandbox|Switzerland|size=x8px}}
 
|-
 
! 10x8px
 
|
 
*{{flag|Qatar|size=10x8px}}
 
*{{flag|Palau|size=10x8px}}
 
*{{flag|Switzerland|size=10x8px}}
 
|
 
*{{flag/sandbox|Qatar|size=10x8px}}
 
*{{flag/sandbox|Palau|size=10x8px}}
 
*{{flag/sandbox|Switzerland|size=10x8px}}
 
|-
 
! 35px
 
|
 
*{{flag|Qatar|size=35px}}
 
*{{flag|Palau|size=35px}}
 
*{{flag|Switzerland|size=35px}}
 
|
 
*{{flag/sandbox|Qatar|size=35px}}
 
*{{flag/sandbox|Palau|size=35px}}
 
*{{flag/sandbox|Switzerland|size=35px}}
 
|-
 
! x24px
 
|
 
*{{flag|Qatar|size=x24px}}
 
*{{flag|Palau|size=x24px}}
 
*{{flag|Switzerland|size=x24px}}
 
|
 
*{{flag/sandbox|Qatar|size=x24px}}
 
*{{flag/sandbox|Palau|size=x24px}}
 
*{{flag/sandbox|Switzerland|size=x24px}}
 
|-
 
! 35x24px
 
|
 
*{{flag|Qatar|size=35x24px}}
 
*{{flag|Palau|size=35x24px}}
 
*{{flag|Switzerland|size=35x24px}}
 
|
 
*{{flag/sandbox|Qatar|size=35x24px}}
 
*{{flag/sandbox|Palau|size=35x24px}}
 
*{{flag/sandbox|Switzerland|size=35x24px}}
 
|}
 
 
====Qatar problem====
 
If the height of the flag icon is specified but the width is not (a size of the form <code>x..px</code>), the sandbox makes an assumption of the width of the icon to determine the size of the surrounding box. This assumption is currently 2.2&times; the height (the multiplication factor in the second if case of [[Module:Sandbox/SiBr4|the invoked Lua module]]). For flags with an aspect ratio larger than this factor, such as that of Qatar, the country name will overlap the flag icon at large sizes:
 
*{{flag/sandbox|Qatar|size=x5px}} (<code>x5px</code>)
 
*{{flag/sandbox|Qatar|size=x10px}} (<code>x10px</code>)
 
*{{flag/sandbox|Qatar|size=x15px}} (<code>x15px</code>)
 
*{{flag/sandbox|Qatar|size=x20px}} (<code>x20px</code>)
 
*{{flag/sandbox|Qatar|size=x25px}} (<code>x25px</code>)
 
*{{flag/sandbox|Qatar|size=x30px}} (<code>x30px</code>)
 
*{{flag/sandbox|Qatar|size=x35px}} (<code>x35px</code>)
 
 
If the factor is increased, there would be no overlap, but there would be a lot of whitespace between the icon and the link for other flags. This is what a list would look like with factor 2.6 and height <code>x30px</code>:
 
*{{flag/sandbox|Qatar|size=78x30px}}
 
*{{flag/sandbox|Australia|size=78x30px}}
 
*{{flag/sandbox|Palau|size=78x30px}}
 
*{{flag/sandbox|San Marino|size=78x30px}}
 
*{{flag/sandbox|Switzerland|size=78x30px}}
 
 
Also, some flags are even longer than the flag of Qatar, which would require an even greater factor. The former state flag of Iran (<code>1925</code> variant in [[Template:Country data Iran]]) has a ratio of 1:3, which with factor 2.6 and height 30px looks like this:
 
*<span style="display:inline-block;width:85px;">[[File:State Flag of Iran (1933-1964).svg|border|x30px|link=]]</span>[[Iran]]
 

Revision as of 21:55, 2 August 2014