blob: 2675a7a81dcbcc030393389bd6212a245f0fd94c [file] [log] [blame]
<HTML><HEAD><META CONTENT="text/html; charset=UTF-8" HTTP-EQUIV="Content-Type"/><TITLE>EMMA Coverage Report</TITLE><STYLE TYPE="text/css"> TABLE,TD,TH {border-style:solid; border-color:black;} TD,TH {background:white;margin:0;line-height:100%;padding-left:0.5em;padding-right:0.5em;} TD {border-width:0 1px 0 0;} TH {border-width:1px 1px 1px 0;} TR TD.h {color:red;} TABLE {border-spacing:0; border-collapse:collapse;border-width:0 0 1px 1px;} P,H1,H2,H3,TH {font-family:verdana,arial,sans-serif;font-size:10pt;} TD {font-family:courier,monospace;font-size:10pt;} TABLE.hdft {border-spacing:0;border-collapse:collapse;border-style:none;} TABLE.hdft TH,TABLE.hdft TD {border-style:none;line-height:normal;} TABLE.hdft TH.tl,TABLE.hdft TD.tl {background:#6699CC;color:white;} TABLE.hdft TD.nv {background:#6633DD;color:white;} .nv A:link {color:white;} .nv A:visited {color:white;} .nv A:active {color:yellow;} TABLE.hdft A:link {color:white;} TABLE.hdft A:visited {color:white;} TABLE.hdft A:active {color:yellow;} .in {color:#356085;} TABLE.s TD {padding-left:0.25em;padding-right:0.25em;} TABLE.s TD.l {padding-left:0.25em;padding-right:0.25em;text-align:right;background:#F0F0F0;} TABLE.s TR.z TD {background:#FF9999;} TABLE.s TR.p TD {background:#FFFF88;} TABLE.s TR.c TD {background:#CCFFCC;} A:link {color:#0000EE;text-decoration:none;} A:visited {color:#0000EE;text-decoration:none;} A:hover {color:#0000EE;text-decoration:underline;} TABLE.cn {border-width:0 0 1px 0;} TABLE.s {border-width:1px 0 1px 1px;} TD.h {color:red;border-width:0 1px 0 0;} TD.f {border-width:0 1px 0 1px;} TD.hf {color:red;border-width:0 1px 0 1px;} TH.f {border-width:1px 1px 1px 1px;} TR.cis TD {background:#F0F0F0;} TR.cis TD {border-width:1px 1px 1px 0;} TR.cis TD.h {color:red;border-width:1px 1px 1px 0;} TR.cis TD.f {border-width:1px 1px 1px 1px;} TR.cis TD.hf {color:red;border-width:1px 1px 1px 1px;} TD.b {border-style:none;background:transparent;line-height:50%;} TD.bt {border-width:1px 0 0 0;background:transparent;line-height:50%;} TR.o TD {background:#F0F0F0;}TABLE.it {border-style:none;}TABLE.it TD,TABLE.it TH {border-style:none;}</STYLE></HEAD><BODY><TABLE CLASS="hdft" WIDTH="100%" CELLSPACING="0"><TR><TH CLASS="tl"><A HREF="http://www.eclemma.org/">EMMA</A> Coverage Report (generated Tue Dec 23 17:51:45 GMT-05:00 2008)</TH></TR><TR><TD CLASS="nv">[<A HREF="../xslUnitTestCoverage.html">all classes</A>][<A HREF="43.html">org.eclipse.wst.xsl.ui.tests.editor</A>]</TD></TR></TABLE><H2>COVERAGE SUMMARY FOR SOURCE FILE [<SPAN CLASS="in">TestElementCompletionProposal.java</SPAN>]</H2><TABLE WIDTH="100%" CELLSPACING="0"><TR><TH>name</TH><TH>class, %</TH><TH>method, %</TH><TH>block, %</TH><TH>line, %</TH></TR><TR><TD>TestElementCompletionProposal.java</TD><TD>100% (1/1)</TD><TD>100% (13/13)</TD><TD>89%  (388/437)</TD><TD>92%  (98/107)</TD></TR></TABLE><H3>COVERAGE BREAKDOWN BY CLASS AND METHOD</H3><TABLE CLASS="cn" WIDTH="100%" CELLSPACING="0"><TR><TH CLASS="f">name</TH><TH>class, %</TH><TH>method, %</TH><TH>block, %</TH><TH>line, %</TH></TR><TR><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#0">TestElementCompletionProposal</A></TD><TD>100% (1/1)</TD><TD>100% (13/13)</TD><TD>89%  (388/437)</TD><TD>92%  (98/107)</TD></TR><TR><TD CLASS="f"><A HREF="#1">setupProject (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">7%   (2/28)</TD><TD CLASS="h">29%  (2/7)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#2">loadFileForTesting (String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">66%  (21/32)</TD><TD>83%  (5/6)</TD></TR><TR><TD CLASS="f"><A HREF="#3">initializeSourceViewer (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>82%  (33/40)</TD><TD>82%  (9/11)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#4">testXSLWhenPropsoalNotAvailable (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>93%  (67/72)</TD><TD>94%  (15/16)</TD></TR><TR><TD CLASS="f"><A HREF="#0">TestElementCompletionProposal (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (27/27)</TD><TD>100% (10/10)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#6">configureSourceViewer (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (12/12)</TD><TD>100% (3/3)</TD></TR><TR><TD CLASS="f"><A HREF="#7">getProposals (int): ICompletionProposal []</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (8/8)</TD><TD>100% (1/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#8">loadXSLFile (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (13/13)</TD><TD>100% (4/4)</TD></TR><TR><TD CLASS="f"><A HREF="#9">setUp (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (5/5)</TD><TD>100% (3/3)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#a">tearDown (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (3/3)</TD><TD>100% (2/2)</TD></TR><TR><TD CLASS="f"><A HREF="#b">testXSLApplyTemplatesPropsoalAvailable (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (71/71)</TD><TD>100% (16/16)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#c">testXSLChoosePropsoalAvailable (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (71/71)</TD><TD>100% (16/16)</TD></TR><TR><TD CLASS="f"><A HREF="#d">testXSLPropsoalAvailable (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (55/55)</TD><TD>100% (12/12)</TD></TR></TABLE><P></P><TABLE CLASS="s" WIDTH="100%" CELLSPACING="0"><TR><TD CLASS="l">1</TD><TD>/*******************************************************************************</TD></TR><TR><TD CLASS="l">2</TD><TD> * Copyright (c) Standards for Technology in Automotive Retail and others</TD></TR><TR><TD CLASS="l">3</TD><TD> * All rights reserved. This program and the accompanying materials </TD></TR><TR><TD CLASS="l">4</TD><TD> * are made available under the terms of the Eclipse Public License v1.0</TD></TR><TR><TD CLASS="l">5</TD><TD> * which accompanies this distribution, and is available at</TD></TR><TR><TD CLASS="l">6</TD><TD> * http://www.eclipse.org/legal/epl-v10.html</TD></TR><TR><TD CLASS="l">7</TD><TD> * </TD></TR><TR><TD CLASS="l">8</TD><TD> * Contributors:</TD></TR><TR><TD CLASS="l">9</TD><TD> *     David Carver - STAR - bug 244978 - intial API and implementation</TD></TR><TR><TD CLASS="l">10</TD><TD> *******************************************************************************/</TD></TR><TR><TD CLASS="l">11</TD><TD> </TD></TR><TR><TD CLASS="l">12</TD><TD>package org.eclipse.wst.xsl.ui.tests.editor;</TD></TR><TR><TD CLASS="l">13</TD><TD> </TD></TR><TR><TD CLASS="l">14</TD><TD>import java.io.File;</TD></TR><TR><TD CLASS="l">15</TD><TD>import java.io.IOException;</TD></TR><TR><TD CLASS="l">16</TD><TD> </TD></TR><TR><TD CLASS="l">17</TD><TD>import junit.framework.Assert;</TD></TR><TR><TD CLASS="l">18</TD><TD> </TD></TR><TR><TD CLASS="l">19</TD><TD>import org.eclipse.core.resources.IFile;</TD></TR><TR><TD CLASS="l">20</TD><TD>import org.eclipse.core.resources.IProject;</TD></TR><TR><TD CLASS="l">21</TD><TD>import org.eclipse.core.resources.IProjectDescription;</TD></TR><TR><TD CLASS="l">22</TD><TD>import org.eclipse.core.resources.ResourcesPlugin;</TD></TR><TR><TD CLASS="l">23</TD><TD>import org.eclipse.core.runtime.CoreException;</TD></TR><TR><TD CLASS="l">24</TD><TD>import org.eclipse.core.runtime.FileLocator;</TD></TR><TR><TD CLASS="l">25</TD><TD>import org.eclipse.core.runtime.NullProgressMonitor;</TD></TR><TR><TD CLASS="l">26</TD><TD>import org.eclipse.core.runtime.Path;</TD></TR><TR><TD CLASS="l">27</TD><TD>import org.eclipse.jface.text.contentassist.ICompletionProposal;</TD></TR><TR><TD CLASS="l">28</TD><TD>import org.eclipse.swt.SWT;</TD></TR><TR><TD CLASS="l">29</TD><TD>import org.eclipse.swt.widgets.Composite;</TD></TR><TR><TD CLASS="l">30</TD><TD>import org.eclipse.swt.widgets.Display;</TD></TR><TR><TD CLASS="l">31</TD><TD>import org.eclipse.swt.widgets.Shell;</TD></TR><TR><TD CLASS="l">32</TD><TD>import org.eclipse.ui.IEditorPart;</TD></TR><TR><TD CLASS="l">33</TD><TD>import org.eclipse.ui.PlatformUI;</TD></TR><TR><TD CLASS="l">34</TD><TD>import org.eclipse.ui.texteditor.ITextEditor;</TD></TR><TR><TD CLASS="l">35</TD><TD>import org.eclipse.wst.sse.core.StructuredModelManager;</TD></TR><TR><TD CLASS="l">36</TD><TD>import org.eclipse.wst.sse.core.internal.provisional.IModelManager;</TD></TR><TR><TD CLASS="l">37</TD><TD>import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;</TD></TR><TR><TD CLASS="l">38</TD><TD>import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceAlreadyExists;</TD></TR><TR><TD CLASS="l">39</TD><TD>import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse;</TD></TR><TR><TD CLASS="l">40</TD><TD>import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;</TD></TR><TR><TD CLASS="l">41</TD><TD>import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;</TD></TR><TR><TD CLASS="l">42</TD><TD>import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;</TD></TR><TR><TD CLASS="l">43</TD><TD>import org.eclipse.wst.xml.core.internal.encoding.XMLDocumentLoader;</TD></TR><TR><TD CLASS="l">44</TD><TD>import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;</TD></TR><TR><TD CLASS="l">45</TD><TD>import org.eclipse.wst.xsl.ui.internal.StructuredTextViewerConfigurationXSL;</TD></TR><TR><TD CLASS="l">46</TD><TD>import org.eclipse.wst.xsl.ui.internal.contentassist.XSLContentAssistProcessor;</TD></TR><TR><TD CLASS="l">47</TD><TD>import org.eclipse.wst.xsl.ui.tests.AbstractXSLUITest;</TD></TR><TR><TD CLASS="l">48</TD><TD>import org.eclipse.wst.xsl.ui.tests.XSLUITestsPlugin;</TD></TR><TR><TD CLASS="l">49</TD><TD> </TD></TR><TR><TD CLASS="l">50</TD><TD>/**</TD></TR><TR><TD CLASS="l">51</TD><TD> * Tests everything about code completion and code assistance.</TD></TR><TR><TD CLASS="l">52</TD><TD> * </TD></TR><TR><TD CLASS="l">53</TD><TD> */</TD></TR><TR><TD CLASS="l">54</TD><TD>public class TestElementCompletionProposal extends AbstractXSLUITest {</TD></TR><TR><TD CLASS="l">55</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">56</TD><TD>        protected String projectName = null;</TD></TR><TR CLASS="c"><TD CLASS="l">57</TD><TD>        protected String fileName = null;</TD></TR><TR CLASS="c"><TD CLASS="l">58</TD><TD>        protected IFile file = null;</TD></TR><TR CLASS="c"><TD CLASS="l">59</TD><TD>        protected IEditorPart textEditorPart = null;</TD></TR><TR CLASS="c"><TD CLASS="l">60</TD><TD>        protected ITextEditor editor = null;</TD></TR><TR><TD CLASS="l">61</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="0">62</A></TD><TD>        protected XMLDocumentLoader xmlDocumentLoader = null;</TD></TR><TR CLASS="c"><TD CLASS="l">63</TD><TD>        protected IStructuredDocument document = null;</TD></TR><TR CLASS="c"><TD CLASS="l">64</TD><TD>        protected StructuredTextViewer sourceViewer = null;</TD></TR><TR><TD CLASS="l">65</TD><TD>        </TD></TR><TR CLASS="c"><TD CLASS="l">66</TD><TD>        public TestElementCompletionProposal() {</TD></TR><TR><TD CLASS="l">67</TD><TD>                // TODO Auto-generated constructor stub</TD></TR><TR CLASS="c"><TD CLASS="l">68</TD><TD>        }</TD></TR><TR><TD CLASS="l">69</TD><TD>        </TD></TR><TR><TD CLASS="l">70</TD><TD>        /**</TD></TR><TR><TD CLASS="l">71</TD><TD>         * Setup the necessary projects, files, and source viewer for the</TD></TR><TR><TD CLASS="l"><A NAME="9">72</A></TD><TD>         * tests.</TD></TR><TR><TD CLASS="l">73</TD><TD>         */</TD></TR><TR><TD CLASS="l">74</TD><TD>        @Override</TD></TR><TR><TD CLASS="l">75</TD><TD>        protected void setUp() throws Exception {</TD></TR><TR CLASS="c"><TD CLASS="l">76</TD><TD>                super.setUp();</TD></TR><TR CLASS="c"><TD CLASS="l">77</TD><TD>                setupProject();</TD></TR><TR><TD CLASS="l">78</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">79</TD><TD>        }</TD></TR><TR><TD CLASS="l"><A NAME="2">80</A></TD><TD> </TD></TR><TR><TD CLASS="l">81</TD><TD>        protected void loadFileForTesting(String xslFilePath)</TD></TR><TR><TD CLASS="l">82</TD><TD>                        throws ResourceAlreadyExists, ResourceInUse, IOException,</TD></TR><TR><TD CLASS="l">83</TD><TD>                        CoreException {</TD></TR><TR CLASS="c"><TD CLASS="l">84</TD><TD>                file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(xslFilePath));</TD></TR><TR CLASS="c"><TD CLASS="l">85</TD><TD>                if (file != null &amp;&amp; !file.exists()) {</TD></TR><TR CLASS="z"><TD CLASS="l">86</TD><TD>                        Assert.fail(&#34;Unable to locate &#34; + fileName + &#34; stylesheet.&#34;);</TD></TR><TR><TD CLASS="l">87</TD><TD>                }</TD></TR><TR><TD CLASS="l">88</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">89</TD><TD>                loadXSLFile();</TD></TR><TR><TD CLASS="l">90</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">91</TD><TD>                initializeSourceViewer();</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="3">92</A></TD><TD>        }</TD></TR><TR><TD CLASS="l">93</TD><TD> </TD></TR><TR><TD CLASS="l">94</TD><TD>        protected void initializeSourceViewer() {</TD></TR><TR><TD CLASS="l">95</TD><TD>                // some test environments might not have a &#34;real&#34; display</TD></TR><TR CLASS="c"><TD CLASS="l">96</TD><TD>                if(Display.getCurrent() != null) {</TD></TR><TR><TD CLASS="l">97</TD><TD>                        </TD></TR><TR CLASS="c"><TD CLASS="l">98</TD><TD>                        Shell shell = null;</TD></TR><TR CLASS="c"><TD CLASS="l">99</TD><TD>                        Composite parent = null;</TD></TR><TR><TD CLASS="l">100</TD><TD>                        </TD></TR><TR CLASS="c"><TD CLASS="l">101</TD><TD>                        if(PlatformUI.isWorkbenchRunning()) {</TD></TR><TR CLASS="c"><TD CLASS="l">102</TD><TD>                                shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();</TD></TR><TR><TD CLASS="l">103</TD><TD>                        }</TD></TR><TR><TD CLASS="l">104</TD><TD>                        else {        </TD></TR><TR CLASS="z"><TD CLASS="l">105</TD><TD>                                shell = new Shell(Display.getCurrent());</TD></TR><TR><TD CLASS="l">106</TD><TD>                        }</TD></TR><TR CLASS="c"><TD CLASS="l">107</TD><TD>                        parent = new Composite(shell, SWT.NONE);</TD></TR><TR><TD CLASS="l">108</TD><TD>                        </TD></TR><TR><TD CLASS="l">109</TD><TD>                        // dummy viewer</TD></TR><TR CLASS="c"><TD CLASS="l">110</TD><TD>                        sourceViewer = new StructuredTextViewer(parent, null, null, false, SWT.NONE);</TD></TR><TR><TD CLASS="l">111</TD><TD>                }</TD></TR><TR><TD CLASS="l">112</TD><TD>                else {</TD></TR><TR CLASS="z"><TD CLASS="l">113</TD><TD>                        Assert.fail(&#34;Unable to run the test as a display must be available.&#34;);</TD></TR><TR><TD CLASS="l">114</TD><TD>                }</TD></TR><TR><TD CLASS="l">115</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="6">116</A></TD><TD>                configureSourceViewer();</TD></TR><TR CLASS="c"><TD CLASS="l">117</TD><TD>        }</TD></TR><TR><TD CLASS="l">118</TD><TD> </TD></TR><TR><TD CLASS="l">119</TD><TD>        protected void configureSourceViewer() {</TD></TR><TR CLASS="c"><TD CLASS="l">120</TD><TD>                sourceViewer.configure(new StructuredTextViewerConfigurationXSL());</TD></TR><TR><TD CLASS="l">121</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">122</TD><TD>        sourceViewer.setDocument(document);</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="8">123</A></TD><TD>        }</TD></TR><TR><TD CLASS="l">124</TD><TD> </TD></TR><TR><TD CLASS="l">125</TD><TD>        protected void loadXSLFile() throws ResourceAlreadyExists, ResourceInUse,</TD></TR><TR><TD CLASS="l">126</TD><TD>                        IOException, CoreException {</TD></TR><TR CLASS="c"><TD CLASS="l">127</TD><TD>                IModelManager modelManager = StructuredModelManager.getModelManager();</TD></TR><TR CLASS="c"><TD CLASS="l">128</TD><TD>                IStructuredModel model = modelManager.getNewModelForEdit(file, true);</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="1">129</A></TD><TD>                document = model.getStructuredDocument();</TD></TR><TR CLASS="c"><TD CLASS="l">130</TD><TD>        }</TD></TR><TR><TD CLASS="l">131</TD><TD> </TD></TR><TR><TD CLASS="l">132</TD><TD>        protected void setupProject() {</TD></TR><TR CLASS="z"><TD CLASS="l">133</TD><TD>                projectName = &#34;xsltestfiles&#34;;</TD></TR><TR CLASS="z"><TD CLASS="l">134</TD><TD>                IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(projectName);</TD></TR><TR><TD CLASS="l">135</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">136</TD><TD>                IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);</TD></TR><TR><TD CLASS="l">137</TD><TD>                try {</TD></TR><TR CLASS="z"><TD CLASS="l">138</TD><TD>                        project.create(description, new NullProgressMonitor());</TD></TR><TR CLASS="z"><TD CLASS="l">139</TD><TD>                        project.open(new NullProgressMonitor());</TD></TR><TR><TD CLASS="l">140</TD><TD>                }</TD></TR><TR CLASS="c"><TD CLASS="l">141</TD><TD>                catch (CoreException e) {</TD></TR><TR><TD CLASS="l">142</TD><TD>                        </TD></TR><TR><TD CLASS="l">143</TD><TD>                }</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="a">144</A></TD><TD>        }</TD></TR><TR><TD CLASS="l">145</TD><TD>        </TD></TR><TR><TD CLASS="l">146</TD><TD>        @Override</TD></TR><TR><TD CLASS="l">147</TD><TD>        protected void tearDown() throws Exception {</TD></TR><TR CLASS="c"><TD CLASS="l">148</TD><TD>                super.tearDown();</TD></TR><TR CLASS="c"><TD CLASS="l">149</TD><TD>        }</TD></TR><TR><TD CLASS="l">150</TD><TD>        </TD></TR><TR><TD CLASS="l">151</TD><TD>        /**</TD></TR><TR><TD CLASS="l">152</TD><TD>         * Get the content completion proposals at &lt;code&gt;lineNumber&lt;/code&gt;, &lt;code&gt;columnNumber&lt;/code&gt;.</TD></TR><TR><TD CLASS="l">153</TD><TD>         * @param lineNumber</TD></TR><TR><TD CLASS="l">154</TD><TD>         * @param columnNumber</TD></TR><TR><TD CLASS="l"><A NAME="7">155</A></TD><TD>         * @return</TD></TR><TR><TD CLASS="l">156</TD><TD>         * @throws Exception</TD></TR><TR><TD CLASS="l">157</TD><TD>         */</TD></TR><TR><TD CLASS="l">158</TD><TD>        private ICompletionProposal[] getProposals(int offset) throws Exception {</TD></TR><TR CLASS="c"><TD CLASS="l">159</TD><TD>            return new XSLContentAssistProcessor().computeCompletionProposals(sourceViewer, offset); </TD></TR><TR><TD CLASS="l"><A NAME="d">160</A></TD><TD>        }</TD></TR><TR><TD CLASS="l">161</TD><TD>        </TD></TR><TR><TD CLASS="l">162</TD><TD>     </TD></TR><TR><TD CLASS="l">163</TD><TD>    public void testXSLPropsoalAvailable() throws Exception {</TD></TR><TR CLASS="c"><TD CLASS="l">164</TD><TD>                fileName = &#34;testElementProposals.xsl&#34;;</TD></TR><TR CLASS="c"><TD CLASS="l">165</TD><TD>                String xslFilePath = projectName + File.separator + fileName;</TD></TR><TR CLASS="c"><TD CLASS="l">166</TD><TD>                loadFileForTesting(xslFilePath);</TD></TR><TR CLASS="c"><TD CLASS="l">167</TD><TD>                IStructuredDocument document = (IStructuredDocument) sourceViewer.getDocument();</TD></TR><TR><TD CLASS="l">168</TD><TD>                // Column is off by one when calculating for the offset position</TD></TR><TR CLASS="c"><TD CLASS="l">169</TD><TD>                int column = 16;</TD></TR><TR CLASS="c"><TD CLASS="l">170</TD><TD>                int line = 5;</TD></TR><TR><TD CLASS="l">171</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">172</TD><TD>                int offset = document.getLineOffset(line) + column;</TD></TR><TR><TD CLASS="l">173</TD><TD>                </TD></TR><TR><TD CLASS="l">174</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">175</TD><TD>                System.out.println(document.get(document.getLineOffset(line), document.getLineLength(line)));</TD></TR><TR><TD CLASS="l">176</TD><TD>                </TD></TR><TR><TD CLASS="l">177</TD><TD>                // assertEquals(&#34;Line Offset incorrect:&#34;, 189, offset);</TD></TR><TR><TD CLASS="l">178</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">179</TD><TD>            ICompletionProposal[] proposals = getProposals(offset);</TD></TR><TR CLASS="c"><TD CLASS="l">180</TD><TD>            assertNotNull(&#34;Did not find proposals.&#34;, proposals);</TD></TR><TR CLASS="c"><TD CLASS="l">181</TD><TD>            sourceViewer = null;</TD></TR><TR><TD CLASS="l"><A NAME="b">182</A></TD><TD>            </TD></TR><TR CLASS="c"><TD CLASS="l">183</TD><TD>    }</TD></TR><TR><TD CLASS="l">184</TD><TD>    </TD></TR><TR><TD CLASS="l">185</TD><TD>    public void testXSLApplyTemplatesPropsoalAvailable() throws Exception {</TD></TR><TR CLASS="c"><TD CLASS="l">186</TD><TD>                fileName = &#34;testElementProposals.xsl&#34;;</TD></TR><TR CLASS="c"><TD CLASS="l">187</TD><TD>                String xslFilePath = projectName + File.separator + fileName;</TD></TR><TR CLASS="c"><TD CLASS="l">188</TD><TD>                loadFileForTesting(xslFilePath);</TD></TR><TR CLASS="c"><TD CLASS="l">189</TD><TD>                IStructuredDocument document = (IStructuredDocument) sourceViewer.getDocument();</TD></TR><TR><TD CLASS="l">190</TD><TD>                // Column is off by one when calculating for the offset position</TD></TR><TR CLASS="c"><TD CLASS="l">191</TD><TD>                int column = 16;</TD></TR><TR CLASS="c"><TD CLASS="l">192</TD><TD>                int line = 5;</TD></TR><TR><TD CLASS="l">193</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">194</TD><TD>                int offset = document.getLineOffset(line) + column;</TD></TR><TR><TD CLASS="l">195</TD><TD>                // assertEquals(&#34;Line Offset incorrect:&#34;, 189, offset);</TD></TR><TR><TD CLASS="l">196</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">197</TD><TD>            ICompletionProposal[] proposals = getProposals(offset);</TD></TR><TR CLASS="c"><TD CLASS="l">198</TD><TD>            assertNotNull(&#34;Did not find proposals.&#34;, proposals);</TD></TR><TR><TD CLASS="l">199</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">200</TD><TD>            String proposalName = &#34;&#34;;</TD></TR><TR CLASS="c"><TD CLASS="l">201</TD><TD>            for (int cnt = 0; cnt &lt; proposals.length; cnt++) {</TD></TR><TR CLASS="c"><TD CLASS="l">202</TD><TD>                    if (proposals[cnt].getDisplayString().equals(&#34;xsl:apply-templates&#34;)) {</TD></TR><TR CLASS="c"><TD CLASS="l">203</TD><TD>                            proposalName = proposals[cnt].getDisplayString();</TD></TR><TR><TD CLASS="l">204</TD><TD>                    }</TD></TR><TR><TD CLASS="l">205</TD><TD>            }</TD></TR><TR><TD CLASS="l">206</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">207</TD><TD>            assertEquals(&#34;Did not find expected proposal.&#34;, &#34;xsl:apply-templates&#34;, proposalName);</TD></TR><TR><TD CLASS="l">208</TD><TD>            </TD></TR><TR CLASS="c"><TD CLASS="l">209</TD><TD>            sourceViewer = null;</TD></TR><TR><TD CLASS="l"><A NAME="c">210</A></TD><TD>            </TD></TR><TR CLASS="c"><TD CLASS="l">211</TD><TD>    }</TD></TR><TR><TD CLASS="l">212</TD><TD>    </TD></TR><TR><TD CLASS="l">213</TD><TD>    public void testXSLChoosePropsoalAvailable() throws Exception {</TD></TR><TR CLASS="c"><TD CLASS="l">214</TD><TD>                fileName = &#34;testElementProposals.xsl&#34;;</TD></TR><TR CLASS="c"><TD CLASS="l">215</TD><TD>                String xslFilePath = projectName + File.separator + fileName;</TD></TR><TR CLASS="c"><TD CLASS="l">216</TD><TD>                loadFileForTesting(xslFilePath);</TD></TR><TR CLASS="c"><TD CLASS="l">217</TD><TD>                IStructuredDocument document = (IStructuredDocument) sourceViewer.getDocument();</TD></TR><TR><TD CLASS="l">218</TD><TD>                // Column is off by one when calculating for the offset position</TD></TR><TR CLASS="c"><TD CLASS="l">219</TD><TD>                int column = 16;</TD></TR><TR CLASS="c"><TD CLASS="l">220</TD><TD>                int line = 5;</TD></TR><TR><TD CLASS="l">221</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">222</TD><TD>                int offset = document.getLineOffset(line) + column;</TD></TR><TR><TD CLASS="l">223</TD><TD>                // assertEquals(&#34;Line Offset incorrect:&#34;, 189, offset);</TD></TR><TR><TD CLASS="l">224</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">225</TD><TD>            ICompletionProposal[] proposals = getProposals(offset);</TD></TR><TR CLASS="c"><TD CLASS="l">226</TD><TD>            assertNotNull(&#34;Did not find proposals.&#34;, proposals);</TD></TR><TR><TD CLASS="l">227</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">228</TD><TD>            String proposalName = &#34;&#34;;</TD></TR><TR CLASS="c"><TD CLASS="l">229</TD><TD>            for (int cnt = 0; cnt &lt; proposals.length; cnt++) {</TD></TR><TR CLASS="c"><TD CLASS="l">230</TD><TD>                    if (proposals[cnt].getDisplayString().equals(&#34;xsl:choose&#34;)) {</TD></TR><TR CLASS="c"><TD CLASS="l">231</TD><TD>                            proposalName = proposals[cnt].getDisplayString();</TD></TR><TR><TD CLASS="l">232</TD><TD>                    }</TD></TR><TR><TD CLASS="l">233</TD><TD>            }</TD></TR><TR><TD CLASS="l">234</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">235</TD><TD>            assertEquals(&#34;Did not find expected proposal.&#34;, &#34;xsl:choose&#34;, proposalName);</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="4">236</A></TD><TD>            sourceViewer = null;</TD></TR><TR CLASS="c"><TD CLASS="l">237</TD><TD>    }</TD></TR><TR><TD CLASS="l">238</TD><TD>    </TD></TR><TR><TD CLASS="l">239</TD><TD>    public void testXSLWhenPropsoalNotAvailable() throws Exception {</TD></TR><TR CLASS="c"><TD CLASS="l">240</TD><TD>                fileName = &#34;testElementProposals.xsl&#34;;</TD></TR><TR CLASS="c"><TD CLASS="l">241</TD><TD>                String xslFilePath = projectName + File.separator + fileName;</TD></TR><TR CLASS="c"><TD CLASS="l">242</TD><TD>                loadFileForTesting(xslFilePath);</TD></TR><TR CLASS="c"><TD CLASS="l">243</TD><TD>                IStructuredDocument document = (IStructuredDocument) sourceViewer.getDocument();</TD></TR><TR><TD CLASS="l">244</TD><TD>                // Column is off by one when calculating for the offset position</TD></TR><TR CLASS="c"><TD CLASS="l">245</TD><TD>                int column = 16;</TD></TR><TR CLASS="c"><TD CLASS="l">246</TD><TD>                int line = 5;</TD></TR><TR><TD CLASS="l">247</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">248</TD><TD>                int offset = document.getLineOffset(line) + column;</TD></TR><TR><TD CLASS="l">249</TD><TD>                // assertEquals(&#34;Line Offset incorrect:&#34;, 189, offset);</TD></TR><TR><TD CLASS="l">250</TD><TD>                </TD></TR><TR CLASS="c"><TD CLASS="l">251</TD><TD>            ICompletionProposal[] proposals = getProposals(offset);</TD></TR><TR CLASS="c"><TD CLASS="l">252</TD><TD>            assertNotNull(&#34;Did not find proposals.&#34;, proposals);</TD></TR><TR><TD CLASS="l">253</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">254</TD><TD>            String proposalName = &#34;&#34;;</TD></TR><TR CLASS="c"><TD CLASS="l">255</TD><TD>            for (int cnt = 0; cnt &lt; proposals.length; cnt++) {</TD></TR><TR CLASS="c"><TD CLASS="l">256</TD><TD>                    if (proposals[cnt].getDisplayString().equals(&#34;xsl:when&#34;)) {</TD></TR><TR CLASS="z"><TD CLASS="l">257</TD><TD>                            proposalName = proposals[cnt].getDisplayString();</TD></TR><TR><TD CLASS="l">258</TD><TD>                    }</TD></TR><TR><TD CLASS="l">259</TD><TD>            }</TD></TR><TR><TD CLASS="l">260</TD><TD>            </TD></TR><TR CLASS="c"><TD CLASS="l">261</TD><TD>            assertFalse(&#34;xsl:when proposal found when it shouldn't have been.&#34;, proposalName.equals(&#34;xsl:when&#34;));</TD></TR><TR CLASS="c"><TD CLASS="l">262</TD><TD>            sourceViewer = null;</TD></TR><TR CLASS="c"><TD CLASS="l">263</TD><TD>    }</TD></TR><TR><TD CLASS="l">264</TD><TD> </TD></TR><TR><TD CLASS="l">265</TD><TD>    </TD></TR><TR><TD CLASS="l">266</TD><TD>}</TD></TR></TABLE><P></P><TABLE CLASS="hdft" WIDTH="100%" CELLSPACING="0"><TR><TD CLASS="nv">[<A HREF="../xslUnitTestCoverage.html">all classes</A>][<A HREF="43.html">org.eclipse.wst.xsl.ui.tests.editor</A>]</TD></TR><TR><TD CLASS="tl"><A HREF="http://www.eclemma.org/support.html">EMMA 2.0.5312 EclEmma Fix 1</A> (C) Vladimir Roubtsov</TD></TR></TABLE></BODY></HTML>