summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-29 07:07:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-29 07:07:28 +0000
commit20e66521097e88d6ab919004abf65f146b5ebccd (patch)
treea98e88b3a95a8ae13961ff8a05f094009f578b1b
parentd2bc5a94732d8fc9362172cf0223af12068841da (diff)
downloadredmine-20e66521097e88d6ab919004abf65f146b5ebccd.tar.gz
redmine-20e66521097e88d6ab919004abf65f146b5ebccd.zip
Merged r5236 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@5571 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/helpers/gantt.rb4
-rw-r--r--test/unit/lib/redmine/helpers/gantt_test.rb28
2 files changed, 25 insertions, 7 deletions
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb
index f551f1c1a..89b051efb 100644
--- a/lib/redmine/helpers/gantt.rb
+++ b/lib/redmine/helpers/gantt.rb
@@ -642,10 +642,10 @@ module Redmine
end
if progress
- progress_date = start_date + (end_date - start_date) * (progress / 100.0)
+ progress_date = start_date + (end_date - start_date + 1) * (progress / 100.0)
if progress_date > self.date_from && progress_date > start_date
if progress_date < self.date_to
- coords[:bar_progress_end] = progress_date - self.date_from + 1
+ coords[:bar_progress_end] = progress_date - self.date_from
else
coords[:bar_progress_end] = self.date_to - self.date_from + 1
end
diff --git a/test/unit/lib/redmine/helpers/gantt_test.rb b/test/unit/lib/redmine/helpers/gantt_test.rb
index ec9b0651b..6fa349798 100644
--- a/test/unit/lib/redmine/helpers/gantt_test.rb
+++ b/test/unit/lib/redmine/helpers/gantt_test.rb
@@ -537,9 +537,9 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
assert_select "div.version.task_done[style*=left:28px]", true, @response.body
end
- should "Be the total done width of the version" do
+ should "be the total done width of the version" do
@response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4})
- assert_select "div.version.task_done[style*=width:18px]", true, @response.body
+ assert_select "div.version.task_done[style*=width:16px]", true, @response.body
end
end
@@ -697,9 +697,10 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
assert_select "div.task_done[style*=left:28px]", true, @response.body
end
- should "Be the total done width of the issue" do
+ should "be the total done width of the issue" do
@response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
- assert_select "div.task_done[style*=width:18px]", true, @response.body
+ # 15 days * 4 px * 30% - 2 px for borders = 16 px
+ assert_select "div.task_done[style*=width:16px]", true, @response.body
end
should "not be the total done width if the chart starts after issue start date" do
@@ -707,7 +708,24 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase
@response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
assert_select "div.task_done[style*=left:0px]", true, @response.body
- assert_select "div.task_done[style*=width:10px]", true, @response.body
+ assert_select "div.task_done[style*=width:8px]", true, @response.body
+ end
+
+ context "for completed issue" do
+ setup do
+ @issue.done_ratio = 100
+ end
+
+ should "be the total width of the issue" do
+ @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
+ assert_select "div.task_done[style*=width:58px]", true, @response.body
+ end
+
+ should "be the total width of the issue with due_date=start_date" do
+ @issue.due_date = @issue.start_date
+ @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
+ assert_select "div.task_done[style*=width:2px]", true, @response.body
+ end
end
end