Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hi,
I'm writing tests for RewriteTool which I build with spec. I have a TextModel in this tool. When I do: RewriteTool new openWithSpec, TextModel sourceTextArea is initialized, however in tests I don't want to open a tool, just want to initialize it. So I wrote RewriteTool new. Everything is initialized, but TextModel sourceTextArea is nil. And I don't know why. Any thoughts? Best, Mark |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I will say it depends how you initialise your objects ;)
The good way to do it is in the method `initializeWidgets` Could you post it so I can tell you a bit more?
Ben On 06 Aug 2014, at 10:56, Mark Rizun <[hidden email]> wrote: Hi, ... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
initializeWidgets self instantiateModels: #(#sourcePanel #SourcePanel #resultPanel #ResultPanel #matchPanel #MatchPanel #transformPanel #TransformPanel #acceptButton #ButtonModel).
2014-08-06 10:58 GMT+02:00 Benjamin <[hidden email]>:
... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
On 06 Aug 2014, at 11:04, Mark Rizun <[hidden email]> wrote:
In wich panel is your TextModel? Can you show me your `initializeWidgets` method for this panel? Ben |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Actually in each:) I have a class AbstractPanel and there is: initializeWidgets self instantiateModels: #(#templateText #MyTextModel).
templateText dragEnabled; text: self demoText;
ast: (RBParser parseRewriteExpression: self demoText); aboutToStyle: true; model: self;
menuOptionsSelector: #menuActions MyTextModel is a subclass of TextModel
2014-08-06 11:13 GMT+02:00 Benjamin <[hidden email]>:
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hi ! Did you call 'super initailizeWidgets' in the 'initializeWidgets' method of all the subclass of AbstractPanel ?
Thomas. 2014-08-06 11:16 GMT+02:00 Mark Rizun <[hidden email]>:
... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by Mark Rizun
On 06 Aug 2014, at 11:16, Mark Rizun <[hidden email]> wrote:
Could you try to put a `self halt` here to see if you hit it when you initialise your main model? Ben P.S.: why did you need to subclass TextModel? Is there something missing you wanted to have? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Yes it is invoked(I mean initializeWidgets in AbstractPanel) if I do: RewriteTool new. And yes, I needed more functionality for TextModel
2014-08-06 11:26 GMT+02:00 Benjamin <[hidden email]>:
... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Thomas, no I don't have super call, because in subclasses I don't have initializeWidget method 2014-08-06 11:30 GMT+02:00 Mark Rizun <[hidden email]>:
... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by Mark Rizun
On 06 Aug 2014, at 11:30, Mark Rizun <[hidden email]> wrote:
> Yes it is invoked(I mean initializeWidgets in AbstractPanel) if I do: RewriteTool new. If you put the halt after `self instantiateModels: #(#templateText #MyTextModel).` can you confirm that templateText is not nil? > And yes, I needed more functionality for TextModel Which ones? :) Maybe they deserve to be pushed into TextModel Ben |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
The templateText was always initialized. But templateText sourceTextArea is still nil. No they don't:) I just replaced a menu of TextModel with my own, and added some ast support. 2014-08-06 11:45 GMT+02:00 Benjamin <[hidden email]>:
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by Benjamin Van Ryseghem (Pharo)
Okey, I hadn't read your question carefully :) Looking at TextModel>>sourceTextArea, it returns the widget of the model, meaning the adapter to PluggableTextMorph. The adapter (and the Morph behind) is instantiated during the building (called in openWithSpec) of the model, not its initialization.
In short, when you call RewriteTool new, you have a fully initialized description of the GUI, but you don't have the GUI.
Thomas.
2014-08-06 11:45 GMT+02:00 Benjamin <[hidden email]>:
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
On 06 Aug 2014, at 11:52, Thomas Bany <[hidden email]> wrote:
Exactly :) The model hierarchy is made to be independent of the rendering framework behind. Ben |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by Mark Rizun
On 06 Aug 2014, at 11:50, Mark Rizun <[hidden email]> wrote:
> No they don't:) I just replaced a menu of TextModel with my own, and added some ast support. Can’t the menu be changed dynamically in TextModel? Ben |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Maybe it can, but it's more convenient for me to subclass it 6 серп. 2014 12:00, користувач "Benjamin" <[hidden email]> написав:
On 06 Aug 2014, at 11:50, Mark Rizun <[hidden email]> wrote: |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Maybe you can manually set the Adapter?
Ben On 06 Aug 2014, at 12:39, Mark Rizun <[hidden email]> wrote:
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Going through the execution of 'openWithSpec', it looks like the method you are looking for is 'buildWithSpec'. It definitely instantiate the adapters as well as the morphs, with the root of the morph tree being nil.
I can't tell you if everything will work as intended though, but I don't see why not. Benjamin developed Spec and might be able to answer that. Finaly, I don't quite see what is wrong with opening a window in a test, as long as you send 'close' to your model at the end ?
Thomas. 2014-08-06 14:01 GMT+02:00 Benjamin <[hidden email]>:
... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
On 06 Aug 2014, at 14:11, Thomas Bany <[hidden email]> wrote: > Going through the execution of 'openWithSpec', it looks like the method you are looking for is 'buildWithSpec'. It definitely instantiate the adapters as well as the morphs, with the root of the morph tree being nil. > > I can't tell you if everything will work as intended though, but I don't see why not. Benjamin developed Spec and might be able to answer that. `builtWithSpec` should definitely do it :) > Finaly, I don't quite see what is wrong with opening a window in a test, as long as you send 'close' to your model at the end ? Usually you want tests to be runnable in headless mode :) Ben |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by Thomas Bany
Thomas,
The problem is that I already have lots of tests and it's only the beginning. Imagine running 50 tests at one time:) You will see 50 windows on screen. Not very good 2014-08-06 14:11 GMT+02:00 Thomas Bany <[hidden email]>:
... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Thank you very much. buildWithSpec did it:) 2014-08-06 14:20 GMT+02:00 Mark Rizun <[hidden email]>:
... [show rest of quote] |
Free forum by Nabble | Edit this page |