comparison test/unit/lib/redmine/export/pdf_test.rb @ 1295:622f24f53b42 redmine-2.3

Update to Redmine SVN revision 11972 on 2.3-stable branch
author Chris Cannam
date Fri, 14 Jun 2013 09:02:21 +0100
parents 433d4f72a19b
children e248c7af89ec
comparison
equal deleted inserted replaced
1294:3e4c3460b6ca 1295:622f24f53b42
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang 2 # Copyright (C) 2006-2013 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.
14 # You should have received a copy of the GNU General Public License 14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software 15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 require File.expand_path('../../../../../test_helper', __FILE__) 18 require File.expand_path('../../../../../test_helper', __FILE__)
19 require 'iconv'
20 19
21 class PdfTest < ActiveSupport::TestCase 20 class PdfTest < ActiveSupport::TestCase
22 fixtures :users, :projects, :roles, :members, :member_roles, 21 fixtures :users, :projects, :roles, :members, :member_roles,
23 :enabled_modules, :issues, :trackers, :attachments 22 :enabled_modules, :issues, :trackers, :attachments
24 23
34 utf8_txt_3 = "\xe7\x8b\x80\xe7\x8b\x80\xe6\x85\x8b\xe7\x8b\x80" 33 utf8_txt_3 = "\xe7\x8b\x80\xe7\x8b\x80\xe6\x85\x8b\xe7\x8b\x80"
35 if utf8_txt_1.respond_to?(:force_encoding) 34 if utf8_txt_1.respond_to?(:force_encoding)
36 txt_1 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(utf8_txt_1, encoding) 35 txt_1 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(utf8_txt_1, encoding)
37 txt_2 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(utf8_txt_2, encoding) 36 txt_2 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(utf8_txt_2, encoding)
38 txt_3 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(utf8_txt_3, encoding) 37 txt_3 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(utf8_txt_3, encoding)
39 assert_equal "?\x91\xd4", txt_1 38 assert_equal "?\x91\xd4".force_encoding("ASCII-8BIT"), txt_1
40 assert_equal "?\x91\xd4?", txt_2 39 assert_equal "?\x91\xd4?".force_encoding("ASCII-8BIT"), txt_2
41 assert_equal "??\x91\xd4?", txt_3 40 assert_equal "??\x91\xd4?".force_encoding("ASCII-8BIT"), txt_3
42 assert_equal "ASCII-8BIT", txt_1.encoding.to_s 41 assert_equal "ASCII-8BIT", txt_1.encoding.to_s
43 assert_equal "ASCII-8BIT", txt_2.encoding.to_s 42 assert_equal "ASCII-8BIT", txt_2.encoding.to_s
44 assert_equal "ASCII-8BIT", txt_3.encoding.to_s 43 assert_equal "ASCII-8BIT", txt_3.encoding.to_s
45 elsif RUBY_PLATFORM == 'java' 44 elsif RUBY_PLATFORM == 'java'
46 assert_equal "??", 45 assert_equal "??",