'7'), $req); $view = 'video'; ob_start(); try { include __DIR__.'/../../web/skins/classic/views/video.php'; } catch (Throwable $e) { ob_end_clean(); return 'threw: '.$e->getMessage(); } return ob_get_clean() === false ? 'fail' : 'ok'; } $defRate = 100; $defScale = 'fit_to_width'; check('fit_to_width default scale does not throw', view(array()), 'ok'); check('default scale is a usable one', $scale, 100); check('scale choices are all numeric and positive', count(array_filter(array_keys($selects['scale']), function ($k) { return !is_numeric($k) || $k <= 0; })), 0); check('rate choices are all positive', count(array_filter(array_keys($selects['rate']), function ($k) { return $k <= 0; })), 0); check('the default rate is one of the choices', isset($selects['rate'][$rate]), true); $defScale = '640px'; check('px default scale does not throw', view(array()), 'ok'); check('px default scale falls back to actual size', $scale, 100); $defScale = '50'; view(array()); check('a numeric monitor default scale is kept', $scale, 50); // An EventPrefix like "side-" or "room-" puts a word starting with s or r in the file name $defScale = 100; file_put_contents($tmpdir.'/side-7-r2-s0_5.mp4', 'x'); check('file names with an s or r word in the event name do not throw', view(array()), 'ok'); check('showIndex sizes by the scale option only', view(array('showIndex' => '0')).' '.$size, 'ok 320x240'); check('showIndex does not change the form default scale', $scale, 100); file_put_contents($tmpdir.'/room-8.mp4', 'x'); check('a file with no options lists fine', view(array()), 'ok'); exit($failures ? 1 : 0); }