Bug 197666 - [Cheatsheet][Simple][Tests][Conf] JUnit tests for XML model
Summary: [Cheatsheet][Simple][Tests][Conf] JUnit tests for XML model
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Jacek Pospychala CLA
QA Contact:
URL:
Whiteboard:
Keywords: bugday, contributed
Depends on: 226800
Blocks: 199765
  Show dependency tree
 
Reported: 2007-07-24 12:01 EDT by Mike Pawlowski CLA
Modified: 2008-04-12 08:02 EDT (History)
4 users (show)

See Also:


Attachments
org.eclipse.pde.ui.tests.patch (8.11 KB, patch)
2008-03-11 10:55 EDT, Chris Aniszczyk CLA
no flags Details | Diff
some tests (10.34 KB, patch)
2008-03-17 09:58 EDT, Jacek Pospychala CLA
no flags Details | Diff
test (37.04 KB, patch)
2008-04-12 07:59 EDT, Jacek Pospychala CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Pawlowski CLA 2007-07-24 12:01:50 EDT
Need to incrementally test model rewrite for Bug # 193214.
Comment 1 Brian Bauman CLA 2008-01-14 17:24:18 EST
J-Unit test cases would be nice but don't have enough time in 3.4 to include them for the Simple Cheatsheet.
Comment 2 Chris Aniszczyk CLA 2008-03-08 17:37:48 EST
Anyone want to be a hero and write some JUnit's ;)?
Comment 3 Jacek Pospychala CLA 2008-03-10 12:41:08 EDT
I'm all ears to junits :)
but hm where's the code to be tested?
I walked over all pde.ui classes matching "*editors.cheatsheet*" but didn't find any cvs changes labeled [193214]
Comment 4 Chris Aniszczyk CLA 2008-03-10 12:54:43 EDT
Let me see if I can give you a simple patch to start with >:)
Comment 5 Chris Aniszczyk CLA 2008-03-11 10:55:50 EDT
Created attachment 92171 [details]
org.eclipse.pde.ui.tests.patch

Here is a patch I will commit to CVS that adds a simple test case for the cheatsheet model. This should help you get started as it sets up the basis on how to test the rest of the cheatsheet model.
Comment 6 Chris Aniszczyk CLA 2008-03-11 10:58:35 EDT
btw Jacek, you're a true hero to do JUnits for PDE...

We're so thankful that there's no code coverage running against PDE now ;)
Comment 7 Jacek Pospychala CLA 2008-03-11 11:05:15 EDT
you know it's my passion (who else would take testing as M.Sc. topic?) ;)
I'll try to look at this later this week.
Comment 8 Jacek Pospychala CLA 2008-03-17 06:26:06 EDT
using simple stylesheets API i noticed that items in cheatsheet are indexed from 1, but you can move first item by -1, to index 0, and then subsequentially by -1, to any negative index.
I guess items should not have indexes less than 1. correct?
Comment 9 Jacek Pospychala CLA 2008-03-17 09:20:57 EDT
cheatsheet API fails to parse XML without newline at the end of file.
e.g.:

<?xml version="1.0" encoding="UTF-8"?>
<cheatsheet title="Title"><intro><description></description></intro></cheatsheet>

(without newline after "</cheatsheet>") in cheatsheet editor shows up empty.
Comment 10 Jacek Pospychala CLA 2008-03-17 09:58:18 EDT
Created attachment 92696 [details]
some tests

some more tests. but don't commit yet. Simple Cheatsheet coverage about 40% :)
Comment 11 Chris Aniszczyk CLA 2008-03-17 15:27:43 EDT
(In reply to comment #9)
> cheatsheet API fails to parse XML without newline at the end of file.
> e.g.:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <cheatsheet
> title="Title"><intro><description></description></intro></cheatsheet>
> 
> (without newline after "</cheatsheet>") in cheatsheet editor shows up empty.
> 

That could be a bug in the cheatsheet code or the PDE text framework. I think we support this scenario in the plugin.xml editor.
Comment 12 Chris Aniszczyk CLA 2008-03-17 15:29:42 EDT
(In reply to comment #8)
> using simple stylesheets API i noticed that items in cheatsheet are indexed
> from 1, but you can move first item by -1, to index 0, and then subsequentially
> by -1, to any negative index.
> I guess items should not have indexes less than 1. correct?

I'd try to look into this, it could be just some esoteric issue... we haven't tested the code before so it's good to see if we have issues with the PDE text framework.

Thanks for looking into this Jacek.
Comment 13 Jacek Pospychala CLA 2008-03-17 16:14:15 EDT
(In reply to comment #12)
> I'd try to look into this, it could be just some esoteric issue... we haven't
> tested the code before so it's good to see if we have issues with the PDE text
> framework.

ok, I'll do that and eventually create separate bugs if needed.
thanks for hint :)
Comment 14 Jacek Pospychala CLA 2008-04-11 18:41:41 EDT
(In reply to comment #12)
> (In reply to comment #8)
> > using simple stylesheets API i noticed that items in cheatsheet are indexed
> > from 1, but you can move first item by -1, to index 0, and then subsequentially
> > by -1, to any negative index.
> > I guess items should not have indexes less than 1. correct?
> 
> I'd try to look into this, it could be just some esoteric issue... we haven't
> tested the code before so it's good to see if we have issues with the PDE text
> framework.

ok, my understanding was that ISimpleCS.indexOfItem takes into account only items, but it does exactly the same what indexOf. So in above case index 0 was used by ISimpleCSIntro. I can't repro. negative index any more.

Comment 15 Chris Aniszczyk CLA 2008-04-12 07:42:13 EDT
Let me know when you have something ready to commit Jacek.
Comment 16 Jacek Pospychala CLA 2008-04-12 07:59:47 EDT
Created attachment 95802 [details]
test

tests for cheatsheets. they all pass now. Cover about 50-60% (depends on metrics) of org.eclipse.pde.internal.core.text.cheatsheet.simple package.
Should be good for now...
Comment 17 Chris Aniszczyk CLA 2008-04-12 08:02:15 EDT
That's good for now.

Thanks Jacek, you rock!