Skip to content
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

Refactor swt specs to use a shared context #497

Closed
wants to merge 22 commits into from

Conversation

wasnotrice
Copy link
Member

This is a ginormous refactor of the SWT specs to use a shared context, as @jasonrclark suggested in #482. Specs are broken at almost every individual commit, so it might be best to squash this if we decide to merge it.

This is all a bunch of yak shaving, actually. I was trying to refactor some of the toggle code that looked like @dsl.app.gui.real.disposed? so that we had some better encapsulation, but that was hard to do because of the tests. So you will see some of that along the way--attempts to follow the Law of Demeter. I also removed some unused references, particularly to @container.

I think this will make it much easier to understand the specs, and to change the code without spuriously breaking lots of specs. Thoughts?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.84%) when pulling 9c411b2 on refactor-swt-context into 13be83d on master.

Also, eliminate temporary test-double shims for allowing
differently-named doubles in shared specs
@coveralls
Copy link

Coverage Status

Coverage increased (+0.86%) when pulling 21df1bc on refactor-swt-context into 13be83d on master.

@@ -13,7 +13,7 @@ def initialize(app, point_a, point_b, opts = {})
@app = app

@style = Shoes::Common::Stroke::DEFAULTS.merge(opts)
@style[:strokewidth] ||= @app.style[:strokewidth] || 1
@style[:strokewidth] ||= 1
Copy link
Member

Choose a reason for hiding this comment

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

Why did you get rid of this? Shouldn't @app.style be the right place to save the global styles?

Copy link
Member Author

Choose a reason for hiding this comment

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

I got rid of this because it was the only style attribute being treated this way. The others are set either in the *::DEFAULTS hashes or by merging with the app's style hash in the DSL methods. I didn't think it made sense to treat :strokewidth differently. Plus, it required stubbing #style on the app double in the specs.

Copy link
Member

Choose a reason for hiding this comment

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

Hmmm I personally don't like that this is merged in the DSL method as imo it's not related to the DSL method as parsing the DSL but is rather an important value... we could investigate that at another point though.

@PragTob
Copy link
Member

PragTob commented Dec 11, 2013

I'm a huge 👍 on this refactoring. A lot of the comments are just about deleting out commented talk and some questions (see code comments).

As for rebasing/merge both are fine with me. Although it mgiht be nice to sqquash the separate parts of this PR together. E.g. redraw refactoring, shared context, specs failing on OSX

Thank you Eric! 🚀

@wasnotrice
Copy link
Member Author

@PragTob thanks for the review. I responded to questions inline. Thanks for picking up on the commented-out code I forgot to delete!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.86%) when pulling 181f6e1 on refactor-swt-context into 13be83d on master.

@PragTob
Copy link
Member

PragTob commented Dec 13, 2013

So is there anything missing before we can merge this in? =)

@jasonrclark
Copy link
Member

Finally got down to giving it the read-through I'd been meaning to this morning. :shipit:

@PragTob
Copy link
Member

PragTob commented Dec 13, 2013

@jasonrclark 👍

@PragTob
Copy link
Member

PragTob commented Dec 20, 2013

Waiting for a word from @wasnotrice about if he still wants to add anything or if we can go ahead, emrge this in and make all our SWT specs writing lives much better! =)

@wasnotrice
Copy link
Member Author

Replaced by #507 (same content)

@wasnotrice wasnotrice closed this Dec 20, 2013
@wasnotrice wasnotrice deleted the refactor-swt-context branch June 12, 2014 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants