Merge lp://qastaging/~dyams/unity-2d/update-pips into lp://qastaging/unity-2d

Proposed by Lohith D Shivamurthy
Status: Rejected
Rejected by: Gerry Boland
Proposed branch: lp://qastaging/~dyams/unity-2d/update-pips
Merge into: lp://qastaging/unity-2d
Diff against target: 505 lines (+357/-1)
9 files modified
launcher/LauncherItem.qml (+1/-1)
launcher/LauncherList.qml (+19/-0)
libunity-2d-private/src/launcherapplication.cpp (+32/-0)
libunity-2d-private/src/launcherapplication.h (+4/-0)
libunity-2d-private/src/launcheritem.cpp (+6/-0)
libunity-2d-private/src/launcheritem.h (+2/-0)
libunity-2d-private/src/unity2ddeclarativeview.cpp (+1/-0)
libunity-2d-private/src/unity2ddeclarativeview.h (+1/-0)
tests/launcher/update_pips_tests.rb (+291/-0)
To merge this branch: bzr merge lp://qastaging/~dyams/unity-2d/update-pips
Reviewer Review Type Date Requested Status
Gerry Boland (community) Disapprove
Review via email: mp+89189@code.qastaging.launchpad.net

Description of the change

Launcher tile pips are also used to indicate whether the application windows belong to the same workspace(or screen) or not. Now If all windows of an application belong to different workspace(or screen), launcher should indicate the same with an empty triangle(pip) besides the application tile.

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

You have some Multi-monitor specific code in this that isn't really quite necessary just now. Just target this MR to indicating if applications are on the current workspace (i.e. visible on all monitors) or not.

Revision history for this message
Gerry Boland (gerboland) wrote :

+ objectName: "pips-" + item.name+index

Why do you need this? Won't your test work with

@app.Unity2dPanel() \
.LauncherList( :name => 'main' ) \
.QDeclarativeItem( :name => 'Calculator' ) \
.QDeclarativeImage( :name => 'pips')['source']

852. By Lohith D Shivamurthy

[launcher] Part to changes to update pips to indicate apps on different screen is removed.

Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

> + objectName: "pips-" + item.name+index
>
> Why do you need this? Won't your test work with
>
> @app.Unity2dPanel() \
> .LauncherList( :name => 'main' ) \
> .QDeclarativeItem( :name => 'Calculator' ) \
> .QDeclarativeImage( :name => 'pips')['source']
No. There can be more than one pip for the same tile. Testability will not identify the objects if they don't have unique object names.

Revision history for this message
Gerry Boland (gerboland) wrote :

Aha, the pips are drawn by a repeater, so the original objectName isn't good. Do change it, but still no need for the item.name IMO.

Revision history for this message
Gerry Boland (gerboland) wrote :

About your test suite: this makes a big change so it needs several tests.

First off can you please add a good test-description as a comment to the top of each test-case, like
https://bazaar.launchpad.net/~unity-2d-team/unity-2d/trunk/view/head:/tests/launcher/autohide_show_tests.rb

I'd also prefer you split the test cases just a little, so you get tests for:
1. One app on this workspace only
2. One app on other workspace only
3. Two apps on this workspace
4. Two apps, both on other workspace
5. Two apps, one on this workspace, one on other
6. Three apps all on this workspace
7. Three apps, all but one on this workspace
I know it's a lot, but these are all the possible cases that I see your code influencing.

This code isn't perfect:
+ Timeout.timeout(3){XDo::XWindow.wait_for_window('Calculator')}
When you've one calculator open, this will return immediately. It is possible then that
+ return XDo::XWindow.from_active
will return the first calculator XId.

This is the reason I was using terminals with unique titlebars in other tests. At least then you can uniquely identify the window. Hacky, I know. If you know of a way to run a program & get the XId of the window reliably, I'd love to hear it! (via PID is a good idea, except for Terminal:) )

Have a look at tests/misc/lib/tmpwindow.rb (in latest trunk). It also has a cleanup method so that if a test fails, you don't have non-closed windows to worry about. It will mean you can remove "kill" statements from the start of test-cases. Call the cleanup method in the teardown, it's

@number_of_workspaces - this can be a local variable, so no @.

+ width = %x{xrandr --current | grep \'\*+\' | uniq | awk \'{print $1}\' | cut -d \'x\' -f1}
It would be great if you added this to the XDoTool Ruby bindings for everyone to use. Parsing the output with Ruby would probably be quicker?? :)

Small "puts" comments in your test suite are not necessary either. And there's some extra blank lines.

853. By Lohith D Shivamurthy

[launcher] Refined objectName for pips

Revision history for this message
Gerry Boland (gerboland) wrote :

Minor things:

if (!m_application)
   return windowCount;
Doesn't follow our coding guidelines.

QRect desktopRect = ScreenInfo::instance()->geometry() ; <- rogue space character

if (totalWindows && !windowsInCurrentWorkspace) { <- both variables are integers, is clearer to be a liite more verbose: (totalWindows > 0) etc..

Question: Why LauncherItem::belongsToDifferentWorkspace() always returns false?

Revision history for this message
Gerry Boland (gerboland) wrote :

Functionally the code works well and is looking good!

854. By Lohith D Shivamurthy

[launcher] Included few review comments

Revision history for this message
Lohith D Shivamurthy (dyams) wrote :
Download full text (3.4 KiB)

> About your test suite: this makes a big change so it needs several tests.
>
> First off can you please add a good test-description as a comment to the top
> of each test-case, like
> https://bazaar.launchpad.net/~unity-2d-team/unity-
> 2d/trunk/view/head:/tests/launcher/autohide_show_tests.rb
>
Done

> I'd also prefer you split the test cases just a little, so you get tests for:
> 1. One app on this workspace only
> 2. One app on other workspace only
> 3. Two apps on this workspace
> 4. Two apps, both on other workspace
> 5. Two apps, one on this workspace, one on other
> 6. Three apps all on this workspace
> 7. Three apps, all but one on this workspace
> I know it's a lot, but these are all the possible cases that I see your code
> influencing.
Actually current test suite considers them all. By Two apps you mean an app with two windows not two different applications. no?
Well, current tests already have separate tests for app with only one window and app with more than one window.
When testing with more than one window, i have also tested by moving each window to different workspace individually.
1) Two windows on current workspace
2) One window on current workspace and another window on different workspace
3) Both windows on different workspace than current

>
>
> This code isn't perfect:
> + Timeout.timeout(3){XDo::XWindow.wait_for_window('Calculator')}
> When you've one calculator open, this will return immediately. It is possible
> then that
> + return XDo::XWindow.from_active
> will return the first calculator XId.
>
There is a 'sleep 2' in between the two statements, which helped me to address the issue you have mentioned.

> This is the reason I was using terminals with unique titlebars in other tests.
> At least then you can uniquely identify the window. Hacky, I know. If you know
> of a way to run a program & get the XId of the window reliably, I'd love to
> hear it! (via PID is a good idea, except for Terminal:) )
I can borrow the same idea. If you don't like the 'sleep 2' :)

>
> Have a look at tests/misc/lib/tmpwindow.rb (in latest trunk). It also has a
> cleanup method so that if a test fails, you don't have non-closed windows to
> worry about. It will mean you can remove "kill" statements from the start of
> test-cases. Call the cleanup method in the teardown, it's
>
No, this kill statements are not for cleaning the residues of the test case. Instead it is a prerequisite. If there are more than one window then pip image is different than when there is only one window. So we need to ensure there is no running windows of the test application.

>
> @number_of_workspaces - this can be a local variable, so no @.
>
If I remove that @ I got this error
.update_pips_tests.rb:62: undefined local variable or method `number_of_workspaces' for #<Class:0xb6e7cbf4> (NameError)

> + width = %x{xrandr --current | grep \'\*+\' | uniq | awk \'{print $1}\' | cut
> -d \'x\' -f1}
> It would be great if you added this to the XDoTool Ruby bindings for everyone
> to use. Parsing the output with Ruby would probably be quicker?? :)
>
This is part of multi-monitor stuff, which is totally removed from this MR already
>
> Small "puts" comment...

Read more...

Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

> Minor things:
>
> if (!m_application)
> return windowCount;
> Doesn't follow our coding guidelines.
>
>
> QRect desktopRect = ScreenInfo::instance()->geometry() ; <- rogue space
> character
>
>
> if (totalWindows && !windowsInCurrentWorkspace) { <- both variables are
> integers, is clearer to be a liite more verbose: (totalWindows > 0) etc..
>
>

Done

>
> Question: Why LauncherItem::belongsToDifferentWorkspace() always returns
> false?

It is virtual funtion, So LauncherApplication::belongsToDifferentWorkspace() is what actually gets called. I don't remember why i returned 'false' from there though.

Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

> > Small "puts" comments in your test suite are not necessary either. And
> there's
> > some extra blank lines.
> I have removed 'puts'. I thought they would inform what the test case is doing
> while we are waiting for them to finish. Unfortunately they did serve the
> purpose it seems;)>
I have removed 'puts'. I added them with the intention of informing the nature of tests being executed.
Unfortunately they didn't serve the purpose, it seems :)

Revision history for this message
Gerry Boland (gerboland) wrote :

I recommend you make one commit for every comment considered. It makes reviewing your changes easier.

Revision history for this message
Gerry Boland (gerboland) wrote :

> Actually current test suite considers them all. By Two apps you mean an app
> with two windows not two different applications. no?
> Well, current tests already have separate tests for app with only one window
> and app with more than one window.
> When testing with more than one window, i have also tested by moving each
> window to different workspace individually.
> 1) Two windows on current workspace
> 2) One window on current workspace and another window on different workspace
> 3) Both windows on different workspace than current

Indeed I noticed that. I just think that each of your test cases are doing too much in one go. Hence I wanted the split.

> > This code isn't perfect:
> > + Timeout.timeout(3){XDo::XWindow.wait_for_window('Calculator')}
> > When you've one calculator open, this will return immediately. It is
> possible
> > then that
> > + return XDo::XWindow.from_active
> > will return the first calculator XId.
> >
> There is a 'sleep 2' in between the two statements, which helped me to address
> the issue you have mentioned.

Helps, but not a cure. We cannot assume the machine isn't slow, we don't want failures because of it.

> I can borrow the same idea. If you don't like the 'sleep 2' :)

Please use the tmpwindow lib. It's a bit safer.

>
> >
> > Have a look at tests/misc/lib/tmpwindow.rb (in latest trunk). It also has a
> > cleanup method so that if a test fails, you don't have non-closed windows to
> > worry about. It will mean you can remove "kill" statements from the start of
> > test-cases. Call the cleanup method in the teardown, it's
> >
> No, this kill statements are not for cleaning the residues of the test case.
> Instead it is a prerequisite. If there are more than one window then pip image
> is different than when there is only one window. So we need to ensure there is
> no running windows of the test application.

Ok, in which case, it should be part of "setup" - or maybe "startup" and then being sure that "teardown" closes all windows created during tests.

> > @number_of_workspaces - this can be a local variable, so no @.
> >
> If I remove that @ I got this error
> .update_pips_tests.rb:62: undefined local variable or method
> `number_of_workspaces' for #<Class:0xb6e7cbf4> (NameError)

Oh you use it in the shutdown, I missed that. Apologies.

> > + width = %x{xrandr --current | grep \'\*+\' | uniq | awk \'{print $1}\' |
> cut
> > -d \'x\' -f1}
> > It would be great if you added this to the XDoTool Ruby bindings for
> everyone
> > to use. Parsing the output with Ruby would probably be quicker?? :)
> >
> This is part of multi-monitor stuff, which is totally removed from this MR
> already

Ok.

> I have removed 'puts'. I thought they would inform what the test case is doing
> while we are waiting for them to finish. Unfortunately they did serve the
> purpose it seems;)

I don't care what test is happening, until it fails, in which case the error tells you what test failed. These comments are nice, but will litter log files, so I prefer to not have them.

855. By Lohith D Shivamurthy

[launcher] moved the cleanup and setup code to corresponding functiions

856. By Lohith D Shivamurthy

[launcher] split test cases into smalled pieces

857. By Lohith D Shivamurthy

[launcher] Refined the method open_window.

Revision history for this message
Gerry Boland (gerboland) wrote :

Since we're reviewing a MR for this exact feature to go into shell, this MR is obselete, no?

Revision history for this message
Gerry Boland (gerboland) wrote :

This has been merged into shell, so I consider this branch obselete and thus rejecting.

Works well in shell tho, nice work.

review: Disapprove

Unmerged revisions

857. By Lohith D Shivamurthy

[launcher] Refined the method open_window.

856. By Lohith D Shivamurthy

[launcher] split test cases into smalled pieces

855. By Lohith D Shivamurthy

[launcher] moved the cleanup and setup code to corresponding functiions

854. By Lohith D Shivamurthy

[launcher] Included few review comments

853. By Lohith D Shivamurthy

[launcher] Refined objectName for pips

852. By Lohith D Shivamurthy

[launcher] Part to changes to update pips to indicate apps on different screen is removed.

851. By Lohith D Shivamurthy

[launcher] Added tests to verify windows on different screen. Using verfy_equal instead of asserts

850. By Lohith D Shivamurthy

[launcher] Tests added

849. By Lohith D Shivamurthy

[launcher] update pips to indicate whether the application windows belongs to current workspace/screen or not

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches