diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-11-27 10:00:04 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-11-27 10:00:04 +0000 |
commit | 0eed9198eb3e9b956a1cb1df112aac4e055fe3e3 (patch) | |
tree | 424d0daa4d5194f1ba621943ded83790cb2bdec2 /test | |
parent | d960d2572b4d8733e16ee3a67f7b5ebd5006f42e (diff) | |
download | redmine-0eed9198eb3e9b956a1cb1df112aac4e055fe3e3.tar.gz redmine-0eed9198eb3e9b956a1cb1df112aac4e055fe3e3.zip |
add tests to export issues csv in Traditional Chinese and French for csv separator (#8368)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7943 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/issues_controller_test.rb | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 42ef84776..19f01554b 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -380,6 +380,64 @@ class IssuesControllerTest < ActionController::TestCase end end + def test_index_csv_tw + with_settings :default_language => "zh-TW" do + str1 = "test_index_csv_tw" + issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, + :status_id => 1, :priority => IssuePriority.all.first, + :subject => str1, :estimated_hours => '1234.5') + assert issue.save + assert_equal 1234.5, issue.estimated_hours + + get :index, :project_id => 1, + :f => ['subject'], + :op => '=', :values => [str1], + :c => ['estimated_hours', 'subject'], + :format => 'csv', + :set_filter => 1 + assert_equal 'text/csv', @response.content_type + lines = @response.body.chomp.split("\n") + assert_equal "#{issue.id},1234.5,#{str1}", lines[1] + + str_tw = "Traditional Chinese (\xe7\xb9\x81\xe9\xab\x94\xe4\xb8\xad\xe6\x96\x87)" + if str_tw.respond_to?(:force_encoding) + str_tw.force_encoding('UTF-8') + end + assert_equal str_tw, l(:general_lang_name) + assert_equal ',', l(:general_csv_separator) + assert_equal '.', l(:general_csv_decimal_separator) + end + end + + def test_index_csv_fr + with_settings :default_language => "fr" do + str1 = "test_index_csv_fr" + issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, + :status_id => 1, :priority => IssuePriority.all.first, + :subject => str1, :estimated_hours => '1234.5') + assert issue.save + assert_equal 1234.5, issue.estimated_hours + + get :index, :project_id => 1, + :f => ['subject'], + :op => '=', :values => [str1], + :c => ['estimated_hours', 'subject'], + :format => 'csv', + :set_filter => 1 + assert_equal 'text/csv', @response.content_type + lines = @response.body.chomp.split("\n") + assert_equal "#{issue.id};1234,5;#{str1}", lines[1] + + str_fr = "Fran\xc3\xa7ais" + if str_fr.respond_to?(:force_encoding) + str_fr.force_encoding('UTF-8') + end + assert_equal str_fr, l(:general_lang_name) + assert_equal ';', l(:general_csv_separator) + assert_equal ',', l(:general_csv_decimal_separator) + end + end + def test_index_pdf ["en", "zh", "zh-TW", "ja", "ko"].each do |lang| with_settings :default_language => lang do |