package net.sourceforge.phpeclipse.tests.parser;
/*******************************************************************************
 * Copyright (c) 2002 www.phpeclipse.de All rights
 * reserved. This program and the accompanying materials are made available
 * under the terms of the Common Public License v1.0 which accompanies this
 * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html
 ******************************************************************************/
import net.sourceforge.phpdt.core.tests.util.AbstractCompilerTest;
import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
/**
 * Tests the php parser
 */
public class OverlibTestCase extends AbstractCompilerTest {
//  Parser parser;
  public OverlibTestCase(String name) {
    super(name);
  }
  /**
   * Test the PHP Parser with different PHP snippets
   */
  public void testPHPParser() {
    checkPHP(
    		"\r\n" + 
    		"    /*\r\n" + 
    		"\r\n" + 
    		"	This is version 1.11 of class.overlib for php (http://www.php.net) \r\n" + 
    		"\r\n" + 
    		"	written 1999, 2000, 2001 Patrick Hess <hess@dland.de>\r\n" + 
    		"\r\n" + 
    		"	This software is distributed under GPL.\r\n" + 
    		" \r\n" + 
    		"	overLib is from Eric Bosrup (http://www.bosrup.com/web/overlib/)\r\n" + 
    		"\r\n" + 
    		"	This class is just a driver/container, so most of this wonderful\r\n" + 
    		" \r\n" + 
    		"	work is done by Eric Bosrup! Keep this in mind... \r\n" + 
    		"\r\n" + 
    		"    */\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	class Overlib {\r\n" + 
    		"\r\n" + 
    		"	  public $ol_path          = \"modules/Forums\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_sticky        = false;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_align	        = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_valign        = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_fgcolor       = \"#fcfcfc\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_bgcolor       = \"#0080C0\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_capcolor      = \"#ffffff\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_textcolor     = \"\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_closecolor    = \"\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_textfont      = \"\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_captionfont   = \"\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_closefont     = \"\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_textsize      = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_captionsize   = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_closesize     = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_height        = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_width         = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_border        = 3;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_offsetx       = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_offsety       = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_fgbackground  = \"\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_bgbackground  = \"\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_closetext     = \"Close\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_close         = true;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_noclosetext   = false;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_autostatus    = false;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_autostatuscap = false;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_capicon       = \"images/forum/question.gif\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_snapx         = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_snapy         = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_padxl         = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_padxr         = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_padyt         = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_padyb         = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_fixy          = 0;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_background    = \"\";\r\n" + 
    		"\r\n" + 
    		"	  public $ol_fullhtml      = false;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_timeout	= -1;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_delay		= -1;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_vauto         = false;\r\n" + 
    		"\r\n" + 
    		"	  public $ol_hauto         = false;\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	  function overLib($path = \"\") {\r\n" + 
    		"\r\n" + 
    		"	  	if (strlen($path)) $this->ol_path = $path;\r\n" + 
    		"\r\n" + 
    		"?>\r\n" + 
    		"\r\n" + 
    		"<nolink rel=\'stylesheet\' href=<?php echo \"\'$this->ol_path/overlib.css\' \"; ?> \r\n" + 
    		"\r\n" + 
    		"      type=\'text/css\'>\r\n" + 
    		"\r\n" + 
    		"<div id=\'overDiv\' style=\'position:absolute; visibility:hide; z-index: 1000;\'>\r\n" + 
    		"\r\n" + 
    		"</div>\r\n" + 
    		"\r\n" + 
    		"<script language=\'javascript\' src=<?php echo \"\'$this->ol_path/overlib.js\'\"; ?>>\r\n" + 
    		"\r\n" + 
    		"</script>\r\n" + 
    		"\r\n" + 
    		"<?php\r\n" + 
    		"\r\n" + 
    		"	  }  \r\n" + 
    		"	\r\n" + 
    		" \r\n" + 
    		"\r\n" + 
    		"	  function set($var, $value) {\r\n" + 
    		"\r\n" + 
    		"		$v = \"ol_$var\";\r\n" + 
    		"\r\n" + 
    		"		$this->$v = $value;\r\n" + 
    		"\r\n" + 
    		"	  }\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	  function get($var) {\r\n" + 
    		"\r\n" + 
    		"		$v = \"ol_$var\";\r\n" + 
    		"\r\n" + 
    		"		return($this->$v);\r\n" + 
    		"\r\n" + 
    		"	  }\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	  function over($text, $title = \"\", $status = \"\")\r\n" + 
    		"\r\n" + 
    		"	  {\r\n" + 
    		"\r\n" + 
    		"	    $cmd = \"\'$text\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if(strlen($title)) \r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", CAPTION, \'$title\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if(strlen($status)) \r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", STATUS, \'$status\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if($this->ol_sticky)	\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", STICKY\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if($this->ol_align) {\r\n" + 
    		"\r\n" + 
    		"		switch($this->ol_align) {\r\n" + 
    		"\r\n" + 
    		"		    case 1: $cmd .= \", LEFT\";	break;\r\n" + 
    		"\r\n" + 
    		"		    case 2: $cmd .= \", CENTER\";	break;\r\n" + 
    		"\r\n" + 
    		"		    case 3: $cmd .= \", RIGHT\";	break;\r\n" + 
    		"\r\n" + 
    		"		    default: 			break;\r\n" + 
    		"\r\n" + 
    		"		}\r\n" + 
    		"\r\n" + 
    		"	    }\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if($this->ol_valign) {\r\n" + 
    		"\r\n" + 
    		"		switch($this->ol_valign) {\r\n" + 
    		"\r\n" + 
    		"		    case 1: $cmd .= \", ABOVE\";	break;\r\n" + 
    		"\r\n" + 
    		"		    case 2: $cmd .= \", BELOW\";	break;\r\n" + 
    		"\r\n" + 
    		"		    default: 			break;\r\n" + 
    		"\r\n" + 
    		"		}\r\n" + 
    		"\r\n" + 
    		"	    }\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if (strlen($this->ol_fgbackground)) {\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", FGCOLOR, \'\', FGBACKGROUND, \'$this->ol_fgbackground\'\";\r\n" + 
    		"\r\n" + 
    		"	    } else {\r\n" + 
    		"\r\n" + 
    		"	    	if (strlen($this->ol_fgcolor))\r\n" + 
    		"\r\n" + 
    		"			$cmd .= \", FGCOLOR, \'$this->ol_fgcolor\'\";\r\n" + 
    		"\r\n" + 
    		"	    }\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if (strlen($this->ol_bgbackground)) {\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", BGCOLOR, \'\', BGBACKGROUND, \'$this->ol_bgbackground\'\";\r\n" + 
    		"\r\n" + 
    		"	    } else {\r\n" + 
    		"\r\n" + 
    		"	    	if (strlen($this->ol_bgcolor))\r\n" + 
    		"\r\n" + 
    		"			$cmd .= \", BGCOLOR, \'$this->ol_bgcolor\'\";\r\n" + 
    		"\r\n" + 
    		"	    }\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if (strlen($this->ol_capcolor))\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", CAPCOLOR, \'$this->ol_capcolor\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if (strlen($this->ol_textcolor))\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", TEXTCOLOR, \'$this->ol_textcolor\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if (strlen($this->ol_closecolor))\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", CLOSECOLOR, \'$this->ol_closecolor\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if (strlen($this->ol_textfont))\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", TEXTFONT, \'$this->ol_textfont\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if (strlen($this->ol_captionfont))\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", CAPTIONFONT, \'$this->ol_captionfont\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if (strlen($this->ol_closefont))\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", CLOSEFONT, \'$this->ol_closefont\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_textsize)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", TEXTSIZE, $this->ol_textsize\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_captionsize)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", CAPTIONSIZE, $this->ol_captionsize\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_closesize)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", CLOSESIZE, $this->ol_closesize\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_width)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", WIDTH, $this->ol_width\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_height)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", HEIGHT, $this->ol_height\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_border >= 0)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", BORDER, $this->ol_border\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_offsetx)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", OFFSETX, $this->ol_offsetx\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_offsety)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", OFFSETY, $this->ol_offsety\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if (strlen($this->ol_closetext))\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", CLOSETEXT, \'$this->ol_closetext\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_noclose)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", NOCLOSETEXT\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_autostatus)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", AUTOSTATUS\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_autostatuscap)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", AUTOSTATUSCAP\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if (strlen($this->ol_capicon))\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", CAPICON, \'$this->ol_capicon\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_snapx)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", SNAPX, $this->ol_snapx\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_snapy)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", SNAPY, $this->ol_snapy\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_fixy)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", FIXY, $this->ol_fixy\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_padxl || $this->ol_padxr)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", PADX, $this->ol_padxl, $this->ol_padxr\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_padyt || $this->ol_padyb)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", PADY, $this->ol_padyt, $this->ol_padyb\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if (strlen($this->ol_background))\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", BACKGROUND, \'$this->ol_background\'\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_fullhtml)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", FULLHTML\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_timeout >= 0)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", TIMEOUT, $this->ol_timeout\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_delay >= 0)\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", DELAY, $this->ol_delay\";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_hauto) {\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", HAUTO\";\r\n" + 
    		"\r\n" + 
    		"		$this->ol_hauto = false;\r\n" + 
    		"\r\n" + 
    		"	    }\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    if ($this->ol_vauto) {\r\n" + 
    		"\r\n" + 
    		"		$cmd .= \", VAUTO\";\r\n" + 
    		"\r\n" + 
    		"		$this->ol_hauto = false;\r\n" + 
    		"\r\n" + 
    		"	    }\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    $output=\" onMouseOver=\\\"return overlib($cmd);\\\" \";\r\n" + 
    		"\r\n" + 
    		"	    $output.=\" onMouseOut=\\\"nd();\\\" \";\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	    return ($output);\r\n" + 
    		"\r\n" + 
    		"	  }\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"	  function pover ($text, $title = \"\", $status = \"\") \r\n" + 
    		"\r\n" + 
    		"	  {\r\n" + 
    		"\r\n" + 
    		"	    echo $this->over($text, $title, $status);\r\n" + 
    		"\r\n" + 
    		"	  }\r\n" + 
    		"\r\n" + 
    		"	}\r\n" + 
    		"\r\n" + 
    		"?>\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"\r\n" + 
    		"");
  }
  private void checkPHP(String strEval) {
    if (Scanner.DEBUG) {
      System.out.println("\n------------------------------------");
      System.out.println(strEval);
    }
    checkParsePHP(
        strEval.toCharArray(),
		"");
//    parser.phpParserTester(strEval, 1);
  }
  private void checkHTML(String strEval) {
    if (Scanner.DEBUG) {
      System.out.println("\n------------------------------------");
      System.out.println(strEval);
    }
    checkParseHTML(
        strEval.toCharArray(),
		"");
//    parser.phpParserTester(strEval, 1);
  }
//  private void checkHTML(String strEval) {
//    if (Scanner.DEBUG) {
//      System.out.println("\n------------------------------------");
//      System.out.println(strEval);
//    }
//    parser.parse(strEval);
//  }
//  /**
//   * The JUnit setup method
//   */
//  protected void setUp() {
//    parser = new Parser(null);
//  }
}