Difference between revisions of "Linden Lab Official:Plugin Test App: LLMediaPluginTest"

From Second Life Wiki
Jump to navigation Jump to search
(No difference)

Revision as of 12:46, 4 May 2011

What is the Plugin Test App?

LLMediaPluginTest opening screen.png

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:

  1. Build the Plugin Test App.
  2. Add your new plugin type to the Plugin Test App.
  3. 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:

  1. In Visual Studio, open the Solution Explorer (View->Solution Explorer).
  2. 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.

  1. Modify indra\test_apps\llplugintest\llmediaplugintest.cpp:
    1. 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>
    2. 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>
    3. In LLMediaPluginTest::getRandomMediaSize(), search for "example/example". Add the new helloworld/helloworld plugin type: <cpp> if ( mime_type == "text/html" || mime_type == "example/example" || mime_type == "helloworld/helloworld" ) </cpp>
  2. In indra\test_apps\llplugintest\CMakeLists.txt, search for "media_plugin_example":
    1. In the add_dependencies() section, below media_plugin_example, add the new plugin type:
        media_plugin_helloworld
      
    2. Below the get_target_property() and add_custom_command() section for media_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}
        )
      
  3. In indra\, run develop.py.
  4. Re-build the Plugin Test App.

Adding a new bookmark

To add a new bookmark:

  1. Add a line in indra\test_apps\llplugintest\bookmarks.txt with the following format:
    Description of the link, URL
    For example, add the following to create a bookmark for the example plugin:
    Example - this is the example plugin, example://foo
  2. Save bookmarks.txt.
  3. 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:

  1. Click Rotation, Translate, or Scale and hold the mouse button down.
  2. 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.