Modul:InfopoljeSlika/testniprimeri

Iz Wikipedije, proste enciklopedije
Jump to navigation Jump to search
-- Unit tests for [[Modul:InfopoljeSlika]]. Click talk page to run tests.

local p = require('Modul:UnitTests')

function p:test1_parameters_output()
    self:preprocess_equals_preprocess_many('{{#invoke:InfopoljeSlika|InfopoljeSlika|image=', '}}', '{{#invoke:InfopoljeSlika/peskovnik |InfopoljeSlika|image=', '}}', {
        {'Small Sailboat Image.jpg |alt=Alt'},
        {'Small Sailboat Image.jpg |border=yes'},
        {'Small Sailboat Image.jpg |center=yes'},
        {'Small Sailboat Image.jpg |link=Link'},
        {'Small Sailboat Image.jpg |thumbtime=Thumbtime'},
        {'Small Sailboat Image.jpg |title=Title'},
        {'Small Sailboat Image.jpg |size=75'},
        {'Small Sailboat Image.jpg |size=200'},
        {'Mustela erminea upright.jpg'},
        {'Mustela erminea upright.jpg |upright=1'},
        {'Mustela erminea upright.jpg |upright=yes'},
        {'Mustela erminea upright.jpg |upright=0'},
        {'Mustela erminea upright.jpg |upright=0.75'},
        {'Mustela erminea upright.jpg |upright=1.2'},
        {'Replace this image.svg |suppressplaceholder=no'},
        {'Replace this image.svg'},
        {'The Universal Magazine, Vol. XCV (July 1794).djvu |page=8'},
    })
end

function p:test2_parameters_nowiki()
    self:preprocess_equals_preprocess_many('{{#invoke:InfopoljeSlika|InfopoljeSlika|image=', '}}', '{{#invoke:InfopoljeSlika/peskovnik |InfopoljeSlika|image=', '}}', {
        {'Small Sailboat Image.jpg |alt=Alt'},
        {'Small Sailboat Image.jpg |border=yes'},
        {'Small Sailboat Image.jpg |center=yes'},
        {'Small Sailboat Image.jpg |link=Link'},
        {'Small Sailboat Image.jpg |thumbtime=Thumbtime'},
        {'Small Sailboat Image.jpg |title=Title'},
        {'Small Sailboat Image.jpg |size=75'},
        {'Small Sailboat Image.jpg |size=200'},
        {'Mustela erminea upright.jpg'},
        {'Mustela erminea upright.jpg |upright=1'},
        {'Mustela erminea upright.jpg |upright=yes'},
        {'Mustela erminea upright.jpg |upright=0'},
        {'Mustela erminea upright.jpg |upright=0.75'},
        {'Mustela erminea upright.jpg |upright=1.2'},
        {'Replace this image.svg |suppressplaceholder=no'},
        {'Replace this image.svg'},
        {'The Universal Magazine, Vol. XCV (July 1794).djvu |page=8'},
    },{nowiki=1})
end

function p:test_simple()
    self:preprocess_equals('{{#invoke:InfopoljeSlika/peskovnik|InfopoljeSlika|image=File:Cwm (window manager).png|size=250px}}', '{{#invoke:InfopoljeSlika|InfopoljeSlika|image=File:Cwm (window manager).png|size=250px}}')
end

function p:test_maxsize_height()
    self:preprocess_equals('{{#invoke:InfopoljeSlika/peskovnik|InfopoljeSlika|image=File:Cwm (window manager).png|size=500px|sizedefault=250px|maxsize=x250px}}', '{{#invoke:InfopoljeSlika|InfopoljeSlika|image=File:Cwm (window manager).png|size=500px|sizedefault=250px|maxsize=x250px}}')
end

function p:test_maxsize_width()
    self:preprocess_equals('{{#invoke:InfopoljeSlika/peskovnik|InfopoljeSlika|image=File:Cwm (window manager).png|size=500px|sizedefault=250px|maxsize=250px}}', '{{#invoke:InfopoljeSlika|InfopoljeSlika|image=File:Cwm (window manager).png|size=500px|sizedefault=250px|maxsize=250px}}')
end

return p