comparison test/unit/lib/redmine/export/pdf_test.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents cbb26bc654de
children 622f24f53b42
comparison
equal deleted inserted replaced
929:5f33065ddc4b 1115:433d4f72a19b
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang 2 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
89 assert_equal "Texte encod? en ISO-8859-1", txt_1 89 assert_equal "Texte encod? en ISO-8859-1", txt_1
90 assert_equal "?a?b?c?d?e test", txt_2 90 assert_equal "?a?b?c?d?e test", txt_2
91 end 91 end
92 92
93 def test_attach 93 def test_attach
94 Attachment.storage_path = "#{Rails.root}/test/fixtures/files" 94 set_fixtures_attachments_directory
95 95
96 str2 = "\x83e\x83X\x83g" 96 str2 = "\x83e\x83X\x83g"
97 str2.force_encoding("ASCII-8BIT") if str2.respond_to?(:force_encoding) 97 str2.force_encoding("ASCII-8BIT") if str2.respond_to?(:force_encoding)
98 encoding = ( RUBY_PLATFORM == 'java' ? "SJIS" : "CP932" ) 98 encoding = ( RUBY_PLATFORM == 'java' ? "SJIS" : "CP932" )
99 99
105 assert a1.visible? 105 assert a1.visible?
106 assert a2.readable? 106 assert a2.readable?
107 assert a2.visible? 107 assert a2.visible?
108 108
109 aa1 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "Testfile.PNG", "UTF-8") 109 aa1 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "Testfile.PNG", "UTF-8")
110 assert_not_nil aa1
110 assert_equal 17, aa1.id 111 assert_equal 17, aa1.id
111 aa2 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "test#{str2}.png", encoding) 112 aa2 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "test#{str2}.png", encoding)
113 assert_not_nil aa2
112 assert_equal 19, aa2.id 114 assert_equal 19, aa2.id
113 115
114 User.current = nil 116 User.current = nil
115 assert a1.readable? 117 assert a1.readable?
116 assert (! a1.visible?) 118 assert (! a1.visible?)