Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

fix: make IMGUI tests green #173

Merged
merged 2 commits into from
Sep 25, 2020
Merged

Conversation

aleksei-korolev
Copy link
Contributor

@aleksei-korolev aleksei-korolev commented Sep 19, 2020

Description

Fixes dropdown menu testing by removing a weird piece of code. I don't know why it was there in the first place. It could or could not bite us some time later.

Fixes hotkeys testing by not recording Unity command event that immediately follows hotkey event (otherwise, the hotkey event plays and triggers, say, Paste, then Paste event plays so you get things pasted twice).

Adds a first test for StepWindow to build upon in future.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I ran tests and they are green. I ran tests on develop and they are red.

Checklist

  • My code follows the Coding Conventions
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@aleksei-korolev aleksei-korolev force-pushed the bugfix/make-imgui-tests-green-again branch from a1531c0 to 022185e Compare September 19, 2020 20:42
@aleksei-korolev
Copy link
Contributor Author

I don't mind if you won't review JSON files.

Copy link
Contributor

@Gusinuhe Gusinuhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice initiative 👍
(Not tested yet).

Editor/TestTools/EditorImguiTester/EditorImguiTest.cs Outdated Show resolved Hide resolved
@aleksei-korolev aleksei-korolev force-pushed the bugfix/make-imgui-tests-green-again branch from ab540ff to ec7f3a6 Compare September 19, 2020 21:44
@aleksei-korolev aleksei-korolev marked this pull request as ready for review September 19, 2020 22:04
@aleksei-korolev
Copy link
Contributor Author

Writing your own unit test would be a great way to test this PR ;)

Editor/UI/Drawers/TabsGroupDrawer.cs Outdated Show resolved Hide resolved
Editor/UI/Windows/StepWindow.cs Show resolved Hide resolved
Tests/Editor/CourseWindow/BaseCourseWindowTest.cs Outdated Show resolved Hide resolved
Copy link
Contributor

@Gusinuhe Gusinuhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love that now we can test the step inspector! 👌

The following tests fail:

  • RenameTest

Test RenameTest failed: NUnit.Framework.AssertionException: Expected string length 9 but was 4. Strings differ at index 0.
Expected: "New Step!"
But was: "Test"

  • `CopyOneStepWithHotkeysTest``

Test CopyOneStepWithHotkeysTest failed: NUnit.Framework.AssertionException:
Expected: 2
But was: 1

I tried to re-record them but I got the same result.

@Gusinuhe
Copy link
Contributor

Nice to have

  • Move tests in the test assembly.

Gusinuhe
Gusinuhe previously approved these changes Sep 23, 2020
Copy link
Contributor

@Gusinuhe Gusinuhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests pass now! ❤️

try
{
BaseWhen(result);
BaseThen(result);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about enabling BaseThen to be yielded? That could allow more complex assertions. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you give me example? I can't think of anything that would justify the complexity. Also, we can always do it later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, it does not have to be done now.

But for example, there could be a case where we need to wait until something it is applied (perhaps a frame), yielding the BaseThen would allow us to yield null or WaitUntil.

A potential scenario: a test where a behavior or condition that requires a property is just added to a step, then a new game object is added as a parameter and the "Fix Button" is pressed. We might want to wait for a frame to ensure the required components were added.

@@ -268,7 +263,7 @@ private void DrawTestView(IEditorImguiTest test)
EditorGUILayout.EndHorizontal();
}

private void DrawTestStateIndicator(Vector2 position, TestState state)
private static void DrawTestStateIndicator(Vector2 position, TestState state)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a private helper method that does not use anything from the calling instance. No reason to keep it instance method.

@Luphoxa
Copy link

Luphoxa commented Sep 23, 2020

Tested on my machine & works.

@aleksei-korolev aleksei-korolev force-pushed the bugfix/make-imgui-tests-green-again branch from f253675 to 97c8069 Compare September 23, 2020 15:20
@Gusinuhe Gusinuhe merged commit ad991c9 into develop Sep 25, 2020
@Gusinuhe Gusinuhe deleted the bugfix/make-imgui-tests-green-again branch September 25, 2020 10:26
@ci-innoactive
Copy link

🎉 This PR is included in version 2.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants