array(), 2 => array()); $graphHeight = 200; $chart = array( 'width' => 800, 'height' => 600, 'graph' => array('width' => 700, 'height' => 500, 'activityHeight' => 10), 'data' => array('y' => array('range' => 100)), 'image' => array('width' => 320, 'height' => 240), ); eval($block); check('each monitor gets an activity row', array_keys(isset($chart['activityBars']) ? $chart['activityBars'] : array()), array(1, 2)); check('the first activity row is at the top', isset($chart['activityBars'][1]['top']) ? $chart['activityBars'][1]['top'] : null, 0); check('the event row sits below its activity row', $chart['eventBars'][1]['top'], $chart['graph']['activityBarHeight'] + 1); check('the second monitor starts below the first', isset($chart['activityBars'][2]['top']) ? $chart['activityBars'][2]['top'] : null, $chart['eventBars'][1]['top'] + $chart['graph']['eventBarHeight'] + 1); // The base stylesheet prints those positions. $mode = 'split'; $max_aspect_ratio = 1; $monEventSlots = array(); function render_css($file) { $warnings = array(); set_error_handler(function($no, $str) use (&$warnings) { $warnings[] = $str; return true; }); ob_start(); require $file; $out = ob_get_clean(); restore_error_handler(); return array($out, $warnings); } list($css, $warnings) = render_css($root.'/web/skins/classic/css/base/views/timeline.css.php'); $undefined = array_values(array_filter($warnings, function($w) { return strpos($w, 'char') !== false; })); check('the stylesheet reads no undefined $char', $undefined, array()); check('no row is printed as "top: px"', strpos($css, 'top: px;'), false); check('the second activity row has its position', strpos($css, 'top: '.$chart['activityBars'][2]['top'].'px;') !== false, true); echo $failures ? "\n$failures failed\n" : "\nall passed\n"; exit($failures ? 1 : 0);