<commit_before>import {
  _shadersMaterialStageFS,
  AlphaMode,
  combine,
  GltfLoader,
  LightingModel,
  Matrix3,
  MaterialPipelineStage,
  Resource,
  ResourceCache,
  ShaderBuilder,
} from "../../../Source/Cesium.js";
import ModelLightingOptions from "../../../Source/Scene/ModelExperimental/ModelLightingOptions.js";
import createScene from "../../createScene.js";
import waitForLoaderProcess from "../../waitForLoaderProcess.js";

xdescribe(
  "Scene/ModelExperimental/MaterialPipelineStage",
  function () {
    var scene;
    var gltfLoaders = [];

    beforeAll(function () {
      scene = createScene();
    });

    afterAll(function () {
      scene.destroyForSpecs();
    });

    var mockDefaultTexture = {};
    var mockModel = {
      _defaultTexture: mockDefaultTexture,
    };

    afterEach(function () {
      var gltfLoadersLength = gltfLoaders.length;
      for (var i = 0; i < gltfLoadersLength; ++i) {
        var gltfLoader = gltfLoaders[i];
        if (!gltfLoader.isDestroyed()) {
          gltfLoader.destroy();
        }
      }
      gltfLoaders.length = 0;
      ResourceCache.clearForSpecs();
    });

    function getOptions(gltfPath, options) {
      var resource = new Resource({
        url: gltfPath,
      });

      return combine(options, {
        gltfResource: resource,
        incrementallyLoadTextures: false, // Default to false if not supplied
      });
    }

    function loadGltf(gltfPath, options) {
      var gltfLoader = new GltfLoader(getOptions(gltfPath, options));
      gltfLoaders.push(gltfLoader);
      gltfLoader.load();

      return waitForLoaderProcess(gltfLoader, scene);
    }

    var boomBox = "./Data/Models/PBR/BoomBox/BoomBox.gltf";
    var boomBoxSpecularGlossiness =
      "./Data/Models/PBR/BoomBoxSpecularGlossiness/BoomBox.gltf";
    var boxUnlit = "./Data/Models/PBR/BoxUnlit/BoxUnlit.gltf";

    function expectShaderLines(shaderLines, expected) {
      for (var i = 0; i < expected.length; i++) {
        expect(shaderLines.indexOf(expected[i])).not.toBe(-1);
      }
    }

    function expectUniformMap(uniformMap, expected) {
      for (var key in expected) {
        if (expected.hasOwnProperty(key)) {
          var expectedValue = expected[key];
          var uniformFunction = uniformMap[key];
          expect(uniformFunction).toBeDefined();
          expect(uniformFunction()).toEqual(expectedValue);
        }
      }
    }

    it("adds material uniforms", function () {
      return loadGltf(boomBox).then(function (gltfLoader) {
        var components = gltfLoader.components;
        var primitive = components.nodes[0].primitives[0];
        var shaderBuilder = new ShaderBuilder();
        var uniformMap = {};
        var renderResources = {
          shaderBuilder: shaderBuilder,<commit_msg>Swap out unlit model to test Travis again<commit_after>import {
  _shadersMaterialStageFS,
  AlphaMode,
  combine,
  GltfLoader,
  LightingModel,
  Matrix3,
  MaterialPipelineStage,
  Resource,
  ResourceCache,
  ShaderBuilder,
} from "../../../Source/Cesium.js";
import ModelLightingOptions from "../../../Source/Scene/ModelExperimental/ModelLightingOptions.js";
import createScene from "../../createScene.js";
import waitForLoaderProcess from "../../waitForLoaderProcess.js";

describe(
  "Scene/ModelExperimental/MaterialPipelineStage",
  function () {
    var scene;
    var gltfLoaders = [];

    beforeAll(function () {
      scene = createScene();
    });

    afterAll(function () {
      scene.destroyForSpecs();
    });

    var mockDefaultTexture = {};
    var mockModel = {
      _defaultTexture: mockDefaultTexture,
    };

    afterEach(function () {
      var gltfLoadersLength = gltfLoaders.length;
      for (var i = 0; i < gltfLoadersLength; ++i) {
        var gltfLoader = gltfLoaders[i];
        if (!gltfLoader.isDestroyed()) {
          gltfLoader.destroy();
        }
      }
      gltfLoaders.length = 0;
      ResourceCache.clearForSpecs();
    });

    function getOptions(gltfPath, options) {
      var resource = new Resource({
        url: gltfPath,
      });

      return combine(options, {
        gltfResource: resource,
        incrementallyLoadTextures: false, // Default to false if not supplied
      });
    }

    function loadGltf(gltfPath, options) {
      var gltfLoader = new GltfLoader(getOptions(gltfPath, options));
      gltfLoaders.push(gltfLoader);
      gltfLoader.load();

      return waitForLoaderProcess(gltfLoader, scene);
    }

    var boomBox = "./Data/Models/PBR/BoomBox/BoomBox.gltf";
    var boomBoxSpecularGlossiness =
      "./Data/Models/PBR/BoomBoxSpecularGlossiness/BoomBox.gltf";
    var boxUnlit = "./Data/Models/GltfLoader/UnlitTest/glTF/UnlitTest.gltf";

    function expectShaderLines(shaderLines, expected) {
      for (var i = 0; i < expected.length; i++) {
        expect(shaderLines.indexOf(expected[i])).not.toBe(-1);
      }
    }

    function expectUniformMap(uniformMap, expected) {
      for (var key in expected) {
        if (expected.hasOwnProperty(key)) {
          var expectedValue = expected[key];
          var uniformFunction = uniformMap[key];
          expect(uniformFunction).toBeDefined();
          expect(uniformFunction()).toEqual(expectedValue);
        }
      }
    }

    it("adds material uniforms", function () {
      return loadGltf(boomBox).then(function (gltfLoader) {
        var components = gltfLoader.components;
        var primitive = components.nodes[0].primitives[0];
        var shaderBuilder = new ShaderBuilder();
        var uniformMap = {};
        var renderResources = {
          shaderBuilder: shaderBuilder,
{'fraction_non_alphanumeric': 0.12110972790325449, 'fraction_numerical': 0.002489774141917126, 'mean_word_length': 2.7770315648085964, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1215086', 'n_tokens_mistral': 1687, 'n_tokens_neox': 1657, 'n_words': 322}