class TestActTheme

Public Instance Methods

test_act_css() click to toggle source

Please see check-act-theme.rb for external CSS.

# File vendor/qwik/lib/qwik/act-theme.rb, line 308
def test_act_css
  page = @site['_SiteTheme']
  page.store 't'

  files = @site.files('_SiteTheme')
  files.put 'theme.css', '/* test */'

  res = session '/test/.css/theme.css'
  eq '/* test */', res.body
  eq 'text/css', res['Content-Type']
  files.delete 'theme.css'

  # test_invalid_css
  files.put 'theme.css', '@i'
  res = session '/test/.css/theme.css'
  eq '/* invalid css */', res.body
  files.delete 'theme.css'

  # test_image
  files.put 't.png', 't'
  res = session '/test/.css/t.png'
  eq 't', res.body
  eq 'image/png', res['Content-Type']
  files.delete 't.png'
end
test_act_theme() click to toggle source
# File vendor/qwik/lib/qwik/act-theme.rb, line 283
def test_act_theme
  res = session '/.theme/css/base.css'
  assert_match(/\A\/*/, res.body)
end
test_ext_ico() click to toggle source
# File vendor/qwik/lib/qwik/act-theme.rb, line 334
def test_ext_ico
  # FIXME: This test case is broken.
  res = session("/nosuch.ico")
  #is "text/html; charset=Shift_JIS", res['Content-Type']
  #is 894, res.body

  res = session("/favicon.ico")
  is "image/vnd.microsoft.icon", res['Content-Type']
  is 894, res.body.size     # This size may vary.
end
test_site_theme() click to toggle source
# File vendor/qwik/lib/qwik/act-theme.rb, line 253
def test_site_theme
  res = session

  # test_theme
  eq 'qwikgreen', @action.site_theme

  # test_theme_path
  eq '.theme/qwikgreen/qwikgreen.css', @action.site_theme_path

  page = @site['_SiteConfig']
  page.store(':theme:t')    # No such theme, but this is just a test.
  eq 't', @action.site_theme
  eq '.theme/t/t.css', @action.site_theme_path

  # test_site_theme
  page = @site['_SiteTheme']
  page.store 't'
  files = @site.files('_SiteTheme')
  files.put 'theme.css', 't'
  eq '.css/theme.css', @action.site_theme_path

  t_with_path {
    eq '.css/theme.css', @action.site_theme_path
  }

  t_with_siteurl {
    eq '.css/theme.css', @action.site_theme_path
  }
end
test_theme_all() click to toggle source
# File vendor/qwik/lib/qwik/act-theme.rb, line 288
def test_theme_all
  # test_theme_list
  res = session
  list = @action.theme_list
  eq true, list.include?('qwiksystem')
  eq true, list.include?('qwikborder')
  eq true, 4 <= list.length         # At least 4 themes.

  # test_plg_theme_list
  ok_wi(/<li>qwikborder<\/li>/, '{{theme_list}}')
  ok_wi(/<li>qwiksystem<\/li>/, '{{theme_list}}')

  # test_theme_files
  list = @action.theme_files('qwikborder')
  eq ['qwikborder.css', 'qwikborder_ball.png',
    'qwikborder_h2.png', 'qwikborder_li.png'], list.sort   # It depends.
  eq true, 4 <= list.length         # At least 4 files.
end