-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Date options to rebase dialog (#8289)
- Add "Ignore Date" - Add "Committer Date Is Author Date"
- Loading branch information
George Tisdelle
committed
Jul 17, 2020
1 parent
3c1a5f9
commit 4c7e620
Showing
8 changed files
with
411 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
201 changes: 201 additions & 0 deletions
201
IntegrationTests/UI.IntegrationTests/CommandsDialogs/FormRebaseTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using CommonTestUtils; | ||
using FluentAssertions; | ||
using GitUI; | ||
using GitUI.CommandsDialogs; | ||
using NUnit.Framework; | ||
|
||
namespace GitExtensions.UITests.CommandsDialogs | ||
{ | ||
[Apartment(ApartmentState.STA)] | ||
public class FormRebaseTests | ||
{ | ||
private ReferenceRepository _referenceRepository; | ||
private GitUICommands _commands; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
if (_referenceRepository == null) | ||
{ | ||
_referenceRepository = new ReferenceRepository(); | ||
} | ||
else | ||
{ | ||
_referenceRepository.Reset(); | ||
} | ||
|
||
_commands = new GitUICommands(_referenceRepository.Module); | ||
} | ||
|
||
[Test] | ||
public void Interactive_check_enables_autosquash() | ||
{ | ||
RunFormTest( | ||
form => | ||
{ | ||
var accessor = form.GetTestAccessor(); | ||
accessor.chkInteractive.Checked = true; | ||
accessor.chkAutosquash.Enabled.Should().BeTrue(); | ||
}, | ||
from: "", to: null, onto: null, interactive: false, startRebaseImmediately: false); | ||
} | ||
|
||
[Test] | ||
public void Interactive_uncheck_disables_autosquash() | ||
{ | ||
RunFormTest( | ||
form => | ||
{ | ||
var accessor = form.GetTestAccessor(); | ||
accessor.chkInteractive.Checked = true; | ||
accessor.chkInteractive.Checked = false; | ||
accessor.chkAutosquash.Enabled.Should().BeFalse(); | ||
}, | ||
from: "", to: null, onto: null, interactive: false, startRebaseImmediately: false); | ||
} | ||
|
||
[Test] | ||
public void Ignore_date_check_disables_all_other_options() | ||
{ | ||
RunFormTest( | ||
form => | ||
{ | ||
var accessor = form.GetTestAccessor(); | ||
accessor.chkIgnoreDate.Checked = true; | ||
accessor.chkInteractive.Enabled.Should().BeFalse(); | ||
accessor.chkPreserveMerges.Enabled.Should().BeFalse(); | ||
accessor.chkAutosquash.Enabled.Should().BeFalse(); | ||
accessor.chkCommitterDateIsAuthorDate.Enabled.Should().BeFalse(); | ||
}, | ||
from: "", to: null, onto: null, interactive: false, startRebaseImmediately: false); | ||
} | ||
|
||
[Test] | ||
public void Ignore_date_uncheck_enables_all_options_if_interactive_checked() | ||
{ | ||
RunFormTest( | ||
form => | ||
{ | ||
var accessor = form.GetTestAccessor(); | ||
accessor.chkInteractive.Checked = true; | ||
accessor.chkIgnoreDate.Checked = true; | ||
accessor.chkIgnoreDate.Checked = false; | ||
accessor.chkInteractive.Enabled.Should().BeTrue(); | ||
accessor.chkPreserveMerges.Enabled.Should().BeTrue(); | ||
accessor.chkAutosquash.Enabled.Should().BeTrue(); | ||
accessor.chkCommitterDateIsAuthorDate.Enabled.Should().BeTrue(); | ||
}, | ||
from: "", to: null, onto: null, interactive: false, startRebaseImmediately: false); | ||
} | ||
|
||
[Test] | ||
public void Ignore_date_uncheck_enables_all_options_but_autosquash_if_interactive_not_checked() | ||
{ | ||
RunFormTest( | ||
form => | ||
{ | ||
var accessor = form.GetTestAccessor(); | ||
accessor.chkIgnoreDate.Checked = true; | ||
accessor.chkIgnoreDate.Checked = false; | ||
accessor.chkInteractive.Enabled.Should().BeTrue(); | ||
accessor.chkPreserveMerges.Enabled.Should().BeTrue(); | ||
accessor.chkAutosquash.Enabled.Should().BeFalse(); | ||
accessor.chkCommitterDateIsAuthorDate.Enabled.Should().BeTrue(); | ||
}, | ||
from: "", to: null, onto: null, interactive: false, startRebaseImmediately: false); | ||
} | ||
|
||
[Test] | ||
public void Committer_date_check_disables_all_other_options() | ||
{ | ||
RunFormTest( | ||
form => | ||
{ | ||
var accessor = form.GetTestAccessor(); | ||
accessor.chkCommitterDateIsAuthorDate.Checked = true; | ||
accessor.chkInteractive.Enabled.Should().BeFalse(); | ||
accessor.chkPreserveMerges.Enabled.Should().BeFalse(); | ||
accessor.chkAutosquash.Enabled.Should().BeFalse(); | ||
accessor.chkIgnoreDate.Enabled.Should().BeFalse(); | ||
}, | ||
from: "", to: null, onto: null, interactive: false, startRebaseImmediately: false); | ||
} | ||
|
||
[Test] | ||
public void Committer_date_uncheck_enables_all_options_if_interactive_is_checked() | ||
{ | ||
RunFormTest( | ||
form => | ||
{ | ||
var accessor = form.GetTestAccessor(); | ||
accessor.chkInteractive.Checked = true; | ||
accessor.chkCommitterDateIsAuthorDate.Checked = true; | ||
accessor.chkCommitterDateIsAuthorDate.Checked = false; | ||
accessor.chkInteractive.Enabled.Should().BeTrue(); | ||
accessor.chkPreserveMerges.Enabled.Should().BeTrue(); | ||
accessor.chkAutosquash.Enabled.Should().BeTrue(); | ||
accessor.chkIgnoreDate.Enabled.Should().BeTrue(); | ||
}, | ||
from: "", to: null, onto: null, interactive: false, startRebaseImmediately: false); | ||
} | ||
|
||
[Test] | ||
public void Committer_date_uncheck_enables_all_options_but_autosquash_if_interactive_not_checked() | ||
{ | ||
RunFormTest( | ||
form => | ||
{ | ||
var accessor = form.GetTestAccessor(); | ||
accessor.chkCommitterDateIsAuthorDate.Checked = true; | ||
accessor.chkCommitterDateIsAuthorDate.Checked = false; | ||
accessor.chkInteractive.Enabled.Should().BeTrue(); | ||
accessor.chkPreserveMerges.Enabled.Should().BeTrue(); | ||
accessor.chkAutosquash.Enabled.Should().BeFalse(); | ||
accessor.chkIgnoreDate.Enabled.Should().BeTrue(); | ||
}, | ||
from: "", to: null, onto: null, interactive: false, startRebaseImmediately: false); | ||
} | ||
|
||
private void RunFormTest(Action<FormRebase> testDriver, string from, string to, string onto, | ||
bool interactive, bool startRebaseImmediately) | ||
{ | ||
RunFormTest( | ||
form => | ||
{ | ||
testDriver(form); | ||
return Task.CompletedTask; | ||
}, | ||
from, to, onto, interactive, startRebaseImmediately); | ||
} | ||
|
||
private void RunFormTest(Func<FormRebase, Task> testDriverAsync, string from, string to, | ||
string onto, bool interactive, bool startRebaseImmediately) | ||
{ | ||
UITest.RunForm( | ||
() => | ||
{ | ||
_commands.StartRebaseDialog(owner: null, from, to, onto, interactive, startRebaseImmediately); | ||
}, | ||
testDriverAsync); | ||
} | ||
} | ||
} |
Oops, something went wrong.