Difference between revisions of "Linden Lab Official:Plugin Test App: LLMediaPluginTest"
Jenn Linden (talk | contribs) |
Rand Linden (talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{ | {{:API Portal/navigation|media}} | ||
== What is the Plugin Test App? == | == What is the Plugin Test App? == |
Latest revision as of 13:31, 4 May 2011
What is the Plugin Test App?
The Second Life Viewer source code includes a media plugin test application called LLMediaPluginTest, or the Plugin Test App. This application acts as as a host for any plugin, so you can use it to debug plugins without having to launch the viewer.
Building the Viewer automatically builds the Plugin Test App. You can also build it independently.
Panels and bookmarks
The Plugin Test App enables you to run bookmarks within panels.
Panels are small windows that can run a plugin within the Plugin Test App. You can add, remove, resize, and rotate panels.
A bookmark is a URL with an associated plugin, that you can add to a panel. The Plugin Test App contains a default list of bookmarks that use the WebKit and QuickTime plugins.
Demo video
Aimee Trescothick created a demo video of the Plugin Test App on YouTube.
Debugging a plugin with the Plugin Test App
To test a new plugin with the Plugin Test App:
- Build the Plugin Test App.
- Add your new plugin type to the Plugin Test App.
- Add breakpoints in your code, and use the debug output window to monitor the plugin's activity while you interact with it.
Building the Plugin Test App
To build the Plugin Test App without building the Viewer:
- In Visual Studio, open the Solution Explorer (View->Solution Explorer).
- Right-click on
llmediaplugintest
and select Build.
The executable is located at indra\build-vc80\test_apps\llplugintest\RelWithDebInfo\llmediaplugintest.exe
.
Note: on Mac OS, it's easier to launch this application from its own XCode project located in indra/build-darwin-i386/test_apps/llplugintest
.
Adding a new plugin type
Note: This section assumes you have already built a new plugin to add.
To add a new plugin type to the Plugin Test App, modify indra\test_apps\llplugintest\llmediaplugintest.cpp
and indra\test_apps\llplugintest\CMakeLists.txt
. In the examples below, replace "helloworld" with your MIME type and "media_plugin_helloworld" with the name of your DLL.
- Modify
indra\test_apps\llplugintest\llmediaplugintest.cpp
:- In
LLMediaPluginTest::pluginNameFromMimeType()
, search for the if-statement containing "example/example" and add the new plugin type beneath it: <cpp> else if ( mime_type == "helloworld/helloworld" ) plugin_name = "media_plugin_helloworld.dll"; </cpp> - In
LLMediaPluginTest::mimeTypeFromUrl()
, search for the if-statement containing "example/example" and add the new plugin type beneath it: <cpp> else if ( url.find( "helloworld://" ) != std::string::npos ) // Hello World plugin mime_type = "helloworld/helloworld"; </cpp> - In
LLMediaPluginTest::getRandomMediaSize()
, search for "example/example". Add the newhelloworld/helloworld
plugin type: <cpp> if ( mime_type == "text/html" || mime_type == "example/example" || mime_type == "helloworld/helloworld" ) </cpp>
- In
- In
indra\test_apps\llplugintest\CMakeLists.txt
, search for "media_plugin_example":- In the add_dependencies() section, below
media_plugin_example
, add the new plugin type:media_plugin_helloworld
- Below the
get_target_property()
andadd_custom_command()
section formedia_plugin_example
, add:get_target_property(BUILT_HELLOWORLD_PLUGIN media_plugin_helloworld LOCATION) add_custom_command(TARGET llmediaplugintest POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_HELLOWORLD_PLUGIN} ${PLUGINS_DESTINATION_DIR} DEPENDS ${BUILT_HELLOWORLD_PLUGIN} )
- In the add_dependencies() section, below
- In
indra\
, rundevelop.py
. - Re-build the Plugin Test App.
Adding a new bookmark
To add a new bookmark:
- Add a line in
indra\test_apps\llplugintest\bookmarks.txt
with the following format:- Description of the link, URL
Example - this is the example plugin, example://foo
- Save
bookmarks.txt
. - Re-build the Plugin Test App.
Using the debug output window
Launching the Plugin Test App opens an output window separate from the main application window. This output window displays debugging output from the code you're running. If you add print statements in the plugin code, you can monitor what the plugin is doing.
Interacting with the plugin
To fully exercise the plugin code, run a plugin in single or multiple panels in the Plugin Test App. You can manipulate a panel in the same ways as an object can be manipulated inworld.
Adding a panel
To add a panel, click the Add panel button.
Opening a bookmark in a panel
To open a bookmark in a panel, click the panel to select it, then select a bookmark from the bookmarks list.
Note: To add a bookmark to the bookmark list, follow the instructions for adding a new bookmark.
Removing a panel
To remove a panel, click the panel to select it, then click the Rem panel button.
Rotating, translating, or scaling the panel
To manipulate a panel:
- Click Rotation, Translate, or Scale and hold the mouse button down.
- To change the view angle, position, or size of the panel, move the mouse while continuing to hold the mouse button down.
Crashing the plugin
To simulate crashing the plugin and ensure your code catches all corresponding errors, click Crash plugin.
Hanging the plugin
To simulate a hung plugin, click Hang plugin. This button simply stops the plugin from updating.