ooo-build r14187 - in trunk/extensions/coooder: php source/org/openoffice/coooder/comp/test tests/expected



Author: cbosdo
Date: Thu Oct  2 13:32:54 2008
New Revision: 14187
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14187&view=rev

Log:
script generating the expected results of the tests using geshi

Added:
   trunk/extensions/coooder/php/generate-expected.php   (contents, props changed)
Modified:
   trunk/extensions/coooder/source/org/openoffice/coooder/comp/test/AllTests.java
   trunk/extensions/coooder/tests/expected/css.html
   trunk/extensions/coooder/tests/expected/java.html

Added: trunk/extensions/coooder/php/generate-expected.php
==============================================================================
--- (empty file)
+++ trunk/extensions/coooder/php/generate-expected.php	Thu Oct  2 13:32:54 2008
@@ -0,0 +1,38 @@
+#!/usr/bin/php
+<?php
+/*
+ *   OpenOffice.org extension for syntax highlighting
+ *   Copyright (C) 2008  CÃdric Bosdonnat cedricbosdo openoffice org
+ *
+ *   This library is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU Library General Public
+ *   License as published by the Free Software Foundation; 
+ *   version 2 of the License.
+ *
+ *   This library is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *   Library General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this library; if not, write to the Free
+ *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+include("geshi/geshi.php");
+
+// get the arguments
+
+$sourceFile = $argv[1];
+$destDir = $argv[2];
+
+// Read the file
+$source = file_get_contents($sourceFile);
+$lang = basename($sourceFile, ".txt");
+
+// Run Geshi
+$geshi = new GeSHi($source, $lang);
+$highlighted = $geshi->parse_code();
+
+// Write to the ouput directory
+file_put_contents("$destDir/$lang.html", $highlighted);

Modified: trunk/extensions/coooder/source/org/openoffice/coooder/comp/test/AllTests.java
==============================================================================
--- trunk/extensions/coooder/source/org/openoffice/coooder/comp/test/AllTests.java	(original)
+++ trunk/extensions/coooder/source/org/openoffice/coooder/comp/test/AllTests.java	Thu Oct  2 13:32:54 2008
@@ -18,10 +18,10 @@
  */
 package org.openoffice.coooder.comp.test;
 
-import org.openoffice.coooder.comp.test.base.UnoTestSuite;
-
 import junit.framework.Test;
 
+import org.openoffice.coooder.comp.test.base.UnoTestSuite;
+
 
 public class AllTests  {
 
@@ -29,7 +29,7 @@
         
         // The tests to run by the suite
         Class[] testClasses = new Class[] {
-                DummyTest.class
+                SyntaxTest.class
         };
         
         // Create the test suite

Modified: trunk/extensions/coooder/tests/expected/css.html
==============================================================================
--- trunk/extensions/coooder/tests/expected/css.html	(original)
+++ trunk/extensions/coooder/tests/expected/css.html	Thu Oct  2 13:32:54 2008
@@ -1,8 +1,8 @@
-<pre class="css"><span style="color: #6666ff;">.xformsItem</span> 
-<span style="color: #66cc66;">&#123;</span> 
+<pre class="css css" style="font-family:monospace;">.xformsItem 
+<span style="color: #00AA00;">&#123;</span> 
 <span style="color: #808080; font-style: italic;">/*  border: 1px dashed blue; */</span> 
-    <span style="color: #000000; font-weight: bold;">margin-right</span>: <span style="color: #933;">2px</span>; 
-    <span style="color: #000000; font-weight: bold;">clear</span>: <span style="color: #993333;">both</span>; 
-    <span style="color: #000000; font-weight: bold;">aqua</span>: toto;
-<span style="color: #66cc66;">&#125;</span>
+    <span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span>; 
+    <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span>; 
+    <span style="color: #000000; font-weight: bold;">aqua</span><span style="color: #00AA00;">:</span> toto;
+<span style="color: #00AA00;">&#125;</span>
 &nbsp;</pre>
\ No newline at end of file

Modified: trunk/extensions/coooder/tests/expected/java.html
==============================================================================
--- trunk/extensions/coooder/tests/expected/java.html	(original)
+++ trunk/extensions/coooder/tests/expected/java.html	Thu Oct  2 13:32:54 2008
@@ -1,17 +1,17 @@
-<pre class="java"><span style="color: #808080; font-style: italic;">/**
+<pre class="java java" style="font-family:monospace;"><span style="color: #008000; font-style: italic; font-weight: bold;">/**
  * Highlighter implementation using the GeSHi algorithm adapted to OpenOffice.org API.
  * 
  * @author cbosdonnat
  */</span>
-<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">class</span> HighlighterImpl <span style="color: #000000; font-weight: bold;">extends</span> WeakBase <span style="color: #000000; font-weight: bold;">implements</span> XServiceInfo, XHighlighter <span style="color: #66cc66;">&#123;</span>
+<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">class</span> HighlighterImpl <span style="color: #000000; font-weight: bold;">extends</span> WeakBase <span style="color: #000000; font-weight: bold;">implements</span> XServiceInfo, XHighlighter <span style="color: #009900;">&#123;</span>
 &nbsp;
-    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky";><span style="color: #aaaadd; font-weight: bold;">String</span></a> IMPLEMENTATION_NAME = HighlighterImpl.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
-    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky";><span style="color: #aaaadd; font-weight: bold;">String</span></a><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> SERVICE_NAMES = <span style="color: #66cc66;">&#123;</span> <span style="color: #ff0000;">&quot;org.openoffice.coooder.Highlighter&quot;</span> <span style="color: #66cc66;">&#125;</span>;
+    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky";><span style="color: #003399;">String</span></a> IMPLEMENTATION_NAME <span style="color: #339933;">=</span> HighlighterImpl.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
+    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky";><span style="color: #003399;">String</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> SERVICE_NAMES <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;org.openoffice.coooder.Highlighter&quot;</span> <span style="color: #009900;">&#125;</span>;
 &nbsp;
-    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #993333;">int</span> OPEN = <span style="color: #cc66cc;">0</span>;
-    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #993333;">int</span> CLOSE = <span style="color: #cc66cc;">1</span>;
+    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> OPEN <span style="color: #339933;">=</span> 0;
+    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> CLOSE <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span>;
 &nbsp;
-    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky";><span style="color: #aaaadd; font-weight: bold;">String</span></a> NUMBER_REGEX = <span style="color: #ff0000;">&quot;[-+]?<span style="color: #000099; font-weight: bold;">\\</span>b(?:[0-9]*<span style="color: #000099; font-weight: bold;">\\</span>.)?[0-9]+<span style="color: #000099; font-weight: bold;">\\</span>b&quot;</span>;
+    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky";><span style="color: #003399;">String</span></a> NUMBER_REGEX <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;[-+]?<span style="color: #000099; font-weight: bold;">\\</span>b(?:[0-9]*<span style="color: #000099; font-weight: bold;">\\</span>.)?[0-9]+<span style="color: #000099; font-weight: bold;">\\</span>b&quot;</span>;
 &nbsp;
 &nbsp;
     <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> XComponentContext mContext;
@@ -21,20 +21,20 @@
 &nbsp;
     <span style="color: #000000; font-weight: bold;">private</span> XTextRange mSelectionStart;
     <span style="color: #000000; font-weight: bold;">private</span> XTextDocument mTextDocument;
-    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #993333;">int</span> mLength;
+    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> mLength;
 &nbsp;
 &nbsp;
-    <span style="color: #000000; font-weight: bold;">public</span> HighlighterImpl<span style="color: #66cc66;">&#40;</span>XComponentContext pContext<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
-        mContext = pContext;
-        mPatternsCache = <span style="color: #000000; font-weight: bold;">new</span> CompiledPatternsCache<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
-    <span style="color: #66cc66;">&#125;</span>;
+    <span style="color: #000000; font-weight: bold;">public</span> HighlighterImpl<span style="color: #009900;">&#40;</span>XComponentContext pContext<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
+        mContext <span style="color: #339933;">=</span> pContext;
+        mPatternsCache <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CompiledPatternsCache<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
+    <span style="color: #009900;">&#125;</span>;
 &nbsp;
-    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> XSingleComponentFactory __getComponentFactory<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky";><span style="color: #aaaadd; font-weight: bold;">String</span></a> pImplementationName<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
-        XSingleComponentFactory xFactory = <span style="color: #000000; font-weight: bold;">null</span>;
+    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> XSingleComponentFactory __getComponentFactory<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky";><span style="color: #003399;">String</span></a> pImplementationName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
+        XSingleComponentFactory xFactory <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span>;
 &nbsp;
-        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>pImplementationName.<span style="color: #006600;">equals</span><span style="color: #66cc66;">&#40;</span>IMPLEMENTATION_NAME<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
-            xFactory = Factory.<span style="color: #006600;">createComponentFactory</span><span style="color: #66cc66;">&#40;</span>HighlighterImpl.<span style="color: #000000; font-weight: bold;">class</span>, SERVICE_NAMES<span style="color: #66cc66;">&#41;</span>;   
-        <span style="color: #66cc66;">&#125;</span>
+        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>pImplementationName.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>IMPLEMENTATION_NAME<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
+            xFactory <span style="color: #339933;">=</span> Factory.<span style="color: #006633;">createComponentFactory</span><span style="color: #009900;">&#40;</span>HighlighterImpl.<span style="color: #000000; font-weight: bold;">class</span>, SERVICE_NAMES<span style="color: #009900;">&#41;</span>;   
+        <span style="color: #009900;">&#125;</span>
         <span style="color: #000000; font-weight: bold;">return</span> xFactory;
-    <span style="color: #66cc66;">&#125;</span>
-<span style="color: #66cc66;">&#125;</span></pre>
\ No newline at end of file
+    <span style="color: #009900;">&#125;</span>
+<span style="color: #009900;">&#125;</span></pre>
\ No newline at end of file



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]