-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test and refactor item info display functions #40883
Conversation
There is a bad test case; I was afraid this one might fail, since the item order seems nondeterminstic:
Setting back to WIP to figure it out. |
It would not be a bad idea to add a new argument to (Remember to use localized comparison) |
I spent a while studying that function and some of its invocations, but had some difficulty understanding how it works. I'm also hesitant to change that function, since it's so widely used, and has no test cases. Making it do sorting would be nice, but looks like a minor side-project that I think would be out of scope for this PR. For now I have simply commented out the order-dependent test that was failing. |
Travis CI make+curses build is failing on this test case:
I don't see any way my changes could be the cause of this. |
Yea that's been occasionally failing for a while now. unrelated.
…On Sat, May 30, 2020, 1:18 PM Eric Pierce ***@***.***> wrote:
Travis CI make+curses build is failing on this test case:
npc_test.cpp:255: FAILED:
REQUIRE( guy != nullptr )
with expansion:
nullptr != nullptr
with messages:
Should not crash from infinite recursion
NPC on acid should not acquire unstable footing status
I don't see any way my changes could be the cause of this.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#40883 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGSA5A35ZO5GG5FJ7BG663RUFSZRANCNFSM4NLR37UA>
.
|
My new tests have a handful of problems with trailing whitespace in clang-tidy, which brought a couple more display bugs to my attention, and there's a conflict in src/item.cpp I need to resolve before this can be merged. |
Add new entries to the iteminfo_query enum `iteminfo_parts` for several pieces of info that did not have a part defined before, and uses those parts to flag info for display by the item::info functions: - BASE_OWNER - Item owner (ex. Your Followers) - BASE_DPS - Typical damage per second - FOOD_ALLERGEN - This food will cause an allergic reaction - BOOK_INCLUDED_RECIPES - List of recipes included in a book - DESCRIPTION_ALLERGEN - This clothing will cause an allergic reaction - DESCRIPTION_DIE - This item can be used as a die, and has N sides
Including almond (poison), nutmeg (hallucinogen), apple, quiver, smart phone, arrow, pointy stick, matches, suppressor, human thumb, brewable tennis ball wine, radioactive carafe, super-juicy blueberry gum, some real-life computer literature, power armor and meower armor.
This commit is the rebased summation of dozens of major changes and additions to the iteminfo tests. The entire approach to testing is now strongly centered around the iteminfo_parts enum flags, to verify each piece of information in isolation from the others. Each test case focuses on a particular info function like `basic_info` or `combat_info`, even though the top-level `item::info` function is usually the only one directly invoked. New tests include: - armor fit, sizing, and protection - item volume and weight, stat/skill requirements - food and medicine info - gun and gunmod info - bionic, book, and tool info - debug and final info
Summary
SUMMARY: Infrastructure "Test and refactor item info display functions"
Purpose of change
To make the
item::info
function and its brethren cleaner, more modular, and more well-tested.Describe the solution
Refactors existing iteminfo test cases and adds many new ones. Refactors a few
item::xxx_info
functions.Removes some unnecessary/empty info output, including the following:
The "Compatible magazines:" section, previously displayed for all tools, even those with no magazines:
This "Ammunition" section of combat stats, previously displayed for many kinds of charged battery:
And this empty "Type:" section, formerly displayed for various guns when they did not have a magazine inserted (all glocks, AR pistol, all rivtech guns and many others):
Grants pet armor the possibility to have a
get_base_env_resist
, meaning their fire / acid / env protection is (supposedly) more correctly indicated in the item info panel now, at least based on my test cases - I could not reproduce the change in-game with existing pet armors.Adds
iteminfo_parts
enum values to filter information:Adds many new tests, including:
Finally, adds new test items, including suppressor, matches, apple, brewable tennis ball wine, radioactive carafe, super-juicy blueberry gum, poisonous bitter almonds, hallucinogenic nutmeg, some real-life computer literature, power armor, and meower armor.
Describe alternatives you've considered
Everyone knows the item info panel is far less than ideal. Using tabs or some other hierarchical display/navigation would be great, but even just restructuring the existing info is tricky due to the rigid way the functions are grouped and called. I hope to do some amount of refactoring of these into smaller, more modular pieces - but I consider a total iteminfo display overhaul like #38030 to be well beyond the scope of this PR.
I considered a variety of other cosmetic and phrasing changes, optimizing line-wrapping, making bullet points more consistently presented, and various other presentational improvements - but again, felt those things to be diversions, and outside scope.
Except for the removal of useless "Compatible magazines:" and "Ammunition" sections as noted above, and the relocation of a few pieces of gunmod and UPS info into more appropriate sections, there are no intended changes to the in-game info display.
Testing
tests/cata_test [iteminfo]
In-game testing with various items, to ensure their info displays as expected.
Additional context
This test suite and the item info panel itself have been my pet project since #37823, continuing with #40314 and #40686
Test results with
[iteminfo]
tag: