-
Notifications
You must be signed in to change notification settings - Fork 164
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
Mock render Widgets #405
Comments
@xsebek Right now there is something kinda close to this in the library: One thing I want to highlight about your use case is that it assumes that the only things you'll be testing are things that have Given the function in the library today, renderWidget :: (Ord n) => Maybe AttrMap -> [Widget n] -> DisplayRegion -> Picture I think the task would be to write a wrapper, something like this: renderWidgetPlain :: (Ord n) => Widget n -> Text
renderWidgetPlain w = pictureToText $ renderWidget Nothing [w] (1000, 1000)
pictureToText :: Picture -> Text
pictureToText = ??? It seems to me that I don't have much time right now to look into what that would entail, but I'd be happy to review a patch if you or someone else wants to take a shot at it. I think |
Thanks for the detailed response and tips, @jtdaugherty! 👍 I am glad to hear I was not missing some obvious way to do this. 😅 I don't think I have encountered widgets with infinite size requirements, but I assume there has to be a way to wrap them and display them in a finite region which is what the mock function would do. 🙂 I'll take a look at the |
@xsebek I took a quick look and it looks like the implementation in |
@xsebek is this something you are still interested in working on? I'd like to close this ticket if this is dormant for now, and re-open it or open new ones later if you get into the work and have questions. Let me know! |
Just noting that I'm actively interested in this as well. I'm going to play around with |
I would like to be able to render widgets to
Text
.The documentation of
renderWidget
suggests using theVty
library to renderPicture
, but it is not obvious to me how to do that.What I would like is a function like this:
For example in the Swarm game we have recipes like this:
Connecting widgets by lines looks really nice, but I would also like to print this to the
stdout
and save it on Wiki so that I don't have to run the game to see the recipes.Another use case would be to doctest the UI functions. Something like:
@jtdaugherty would you be interested in having such function in brick? 🙂
Or maybe this is really simple and could just be added as a code snippet to the documentation.
The text was updated successfully, but these errors were encountered: