Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Schema] testing against the ipywidgets schema spec #111

Open
SylvainCorlay opened this issue Feb 20, 2018 · 5 comments
Open

[Schema] testing against the ipywidgets schema spec #111

SylvainCorlay opened this issue Feb 20, 2018 · 5 comments

Comments

@SylvainCorlay
Copy link
Member

It would be interesting to test xwidgets's properties against ipywidget's schemas.

@SylvainCorlay
Copy link
Member Author

SylvainCorlay commented Feb 20, 2018

The current schema spec is a markdown style.

Maybe we could decide on a JSON spec instead of markdown, which we could generate for a list of types of widgets. jupyter-widgets/ipywidgets#1979

@SylvainCorlay
Copy link
Member Author

A simple means to get the default serialized state of e.g. Slider is:

#include <iostream>
#include "xwidgets/xslider.hpp"

// instantiate slider
xw::slider<double> slider;

// retrieve default state
xeus::xjson state; xeus::buffer_sequence buffers;
slider.serialize_state(state, buffers);

// compare state with reference model
std::cout << state << std::endl;

@SylvainCorlay
Copy link
Member Author

from ipywidgets import IntSlider
s = IntSlider()
s.get_state()

@SylvainCorlay
Copy link
Member Author

template <class WT>
void test_widget_schema(std::string& python_widget_type, std::string& python_widget_module)
{
    // instantiate python widget
    // use pybind11
    // get_state();

    auto s = WT();
     // serialize_state();
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant