Page MenuHome

Tests: add regression test for `flip_normals()` operator
Needs ReviewPublic

Authored by Andrea Beconcini (beco) on Jul 4 2021, 4:32 PM.

Details

Summary

This CL adds a simple regression test for flip_normals().

Tests: add regression test for flip_normals() operator
Docs: minor fix to RunTest.run_test()'s test_name type

Updated blend file should be placed in lib/tests/modeling/operators.blend

Diff Detail

Repository
rB Blender
Branch
add_operator_flip_normals_regression_test (branched from master)
Build Status
Buildable 15587
Build 15587: arc lint + arc unit

Event Timeline

Andrea Beconcini (beco) requested review of this revision.Jul 4 2021, 4:32 PM
Andrea Beconcini (beco) created this revision.
Andrea Beconcini (beco) retitled this revision from Docs: minor fix to `RunTest.run_test()`'s `test_name` type to Tests: add regression test for `flip_normals()` operator.Jul 4 2021, 4:37 PM
Andrea Beconcini (beco) edited the summary of this revision. (Show Details)
Habib Gahbiche (zazizizou) requested changes to this revision.Sep 5 2021, 11:50 AM

Hi @Andrea Beconcini (beco), thanks for the patch. The patch is fine in principle, however there a few things I would like to suggest:

  • Rebase your patch. A few things have changed after this year's GSoC
  • Make sure the test can fail, e.g. by flipping normals of the expected object and see if the test can fail.

Also, add a reviewer to your patches in the future so that they get noticed earlier.

This revision now requires changes to proceed.Sep 5 2021, 11:52 AM
Andrea Beconcini (beco) added a comment.EditedSep 16 2021, 10:29 PM

Hi @Habib Gahbiche (zazizizou), thanks for the suggestions.
I'm not really sure how to write the failing case: should I add another expected mesh in the .blend file and compare the result of the flipping operation against the new mesh? Also, I don't know how to mark a SpecMeshTest instance as "expected to fail". Are you aware of any example I can look at?

Rebased to include latest changes

I'm not really sure how to write the failing case

That is for local testing only, all tests committed in repo should pass.
It's similar to what's done in TDD: write a failing test with expected results, make changes in code that get the right result and then the test passes. It's to avoid writing always passing tests by accident.
https://en.wikipedia.org/wiki/Test-driven_development#Test-driven_development_cycle

It's similar to what's done in TDD: write a failing test with expected results, make changes in code that get the right result and then the test passes.

Oh, I did it already then. I created the expected mesh as a simple clone of the test mesh, wrote the test and watched it fail. Then I flipped the normal on the expected object and... profit! (not really earning anything, though ๐Ÿ˜„ ). I've just done it again, just in case..

Thank you, @Ankit Meel (ankitm) for the explanation.

Let me know if there's anything else I need to do!

Jake (Welp) edited the summary of this revision. (Show Details)Dec 3 2021, 8:23 PM
Jake (Welp) accepted this revision.Dec 3 2021, 8:26 PM
Jake (Welp) added a subscriber: Jake (Welp).

Passes and fails properly. Merged the changes from the .blend in the description with the most recent version and replaced it in the description.